I have this javascript code:
function checkUploadedFile() {
var inputFile = $("#fuUploadProfile").val();
if (inputFile != "") {
__doPostBack('btnUploadProfile', '');
} else {
$("#lblMessage").show();
return false;
}
}
here are the controls:
<asp:Label ID="lblMessage" runat="server" CssClass="srn_error">*Required</asp:Label>
<asp:FileUpload ID="fuUploadProfile" runat="server" CssClass="srn_file" />
<asp:Button ID="btnUploadProfile" ClientIDMode="Static" runat="server" Text="Upload" class="srn_button" OnClientClick="checkUploadedFile();" />
Even though I already have selected a file to upload, I get the “Microsoft JScript runtime error: Access is denied.” only when using IE9.
What am I doing wrong?
after much thorough searching of the code, it was due to a javascript that was loaded, which was triggering the ‘click’ event of the asp.net FileUpload control. it seems that IE does not play well with javascript events that trigger a DOM control.
after I disabled the javascript function, it was working perfectly.