In this code:
function OpenUploadFile1() {
var myFrame = document.getElementById('frameUpload1');
$(myFrame).focus();
$(myFrame).contents().find("#upload_1_file").click();
var value = $(myFrame).contents().find("#upload_1_file").val();
if (value != '') {
$(myFrame).contents().find("#upload_1_start").click();
}
}
the line
var value = $(myFrame).contents().find("#upload_1_file").val();
gets executed without waiting for the user to select a file and close the dialog (after the .click above)
in FF/Chrome
, but works fine in IE (at least IE11)
.
frameUpload1
is an iframe
, and upload_1_file
is an asp:UploadFile control
.
EDIT: for clarity, this is how the code is called:
<a href="javascript:void(0)" title="Upload Image" onclick="OpenUploadFile1()">Upload Image</a>
<iframe id="frameUpload1" name="frameUpload1" src="fileupload.aspx" frameborder="0" width="0" height="0"></iframe>
Does anyone know why and how to fix this?
Thanks in advance!