1
최근 파일 업로드에 jQuery/iframe 솔루션을 구현했으며 다소 귀찮은 문제가 발생했습니다 (물론 IE에만 해당).jQuery/iframe 문제 파일 업로드 중
내 업로드 버튼을 클릭하고 업로드 할 파일을 선택하면 해당 파일이 포함 된 양식을 자동으로 내 iframe에 제출합니다. 그러나 제출을 처리하고 내 컨트롤러에서 작업을 시작하려면 페이지의 아무 곳이나 클릭해야합니다.
포커스를 얻는 iframe에 문제가 있다고 생각합니다. '변경'기능이 실행을 끝내지 못하게하는 것처럼 보이지만 완전히 확신 할 수는 없습니다. 어쩌면 실행을 계속하기 위해 iframe이 포커스를 원래 페이지로 되돌리기 위해 어떤 유형의 onload 함수가 필요합니까?
코드 :
양식 & 파일 업로드 :
<form id="attachForm" action="<%= Url.Action("TestUpload","Images") %>"
method="post" enctype="multipart/form-data" target='upload_target' >
<input id='actualupload' type='file' multiple="" name='file' />
</form>
<iframe id='upload_target' name='upload_target' src=''
style="width:0; height: 0; border: 0;" frameborder="0"></iframe>
JQuery와 양식 제출 :
$("#actualupload").live('change',function()
{
$("#attachForm").submit();
alert("Fired!"); //This only occurs after clicking on the screen after the
//file selection.
});
다니엘 감사합니다! 이것은 매력처럼 작동했습니다! –