I have asp.net webforms page with Fileupload control and image. When user clicks on image I trigger FileUpload click and when clicking ok I call __doPostBack on client side. If FileUpload is visible it works fine, but when I set style='visibility: hidden' or display: none - javascript gives error: access denied! It reproduces only in IE, not FF or chrome. Could anybody tell me how to avoid this and post the file to server? I have tried input type='file' with runat='server', non-server input-file - the result is the same...
HTML:
<input id="_ctl00_fuplImage" type="file" style="visibility: hidden" name="$ctl00$fuplImage">
JavaScript:
var fileupload = $('#<%= fuplImage.ClientID %>');
$('#<%= imgPhoto.ClientID %>').click(function() {
fileupload.click();
});
fileupload.change(function() {
var val = fileupload.val();
if (val == '') return;
__doPostBack(fileupload.attr('id'), val);
});
It is unresolvable security issue of IE (only) that does not allow to send form with hidden file upload input. Thank you very much for your help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With