0

I have a file upload and a button in my asp.

this is my aspx:

<asp:Panel ID="stage" runat="server" cssClass="containment-wrapper" style="border:1px solid #000000;">
     <asp:Image ID="imgBrowse" runat="server" Height="375px" Width="640px" ImageUrl="Image/ClickHere.png" style="cursor:pointer"/>
     <asp:FileUpload ID="FileUpload_IE" runat="server" style="display:none;" />
     <asp:Button ID="btn_UploadHandler" runat="server" Text="Button" OnClick="btn_UploadHandler_Click" style="display:none;"/>
</asp:Panel>

I want to fire the click event when the FileUpload_IE has been change. This is my js file:

$("#stage").click(function () {
if (navigator.appName == "Microsoft Internet Explorer") {
    $('#FileUpload_IE')[0].click();       
}
});


 $("#FileUpload_IE").on("change", function (e) {
    $("#btn_UploadHandler").click();
    e.preventDefault();
});

The code has error in jquery 1.10.2 which is elem[ type ](); is access denied.

MMakati
  • 693
  • 1
  • 15
  • 33
  • IE version?, In IE9 there is a problem when the file browser was shown by clicking another element(other than the file input control itself).. not sure about IE10.. in IE11 it works fine... I didn't get any solution for that so In IE9&IE10 instead of showing the image we ended by showing the file control itself – Arun P Johny Feb 14 '14 at 13:50
  • If you select the file by clicking the file control instead of the image it should work fine – Arun P Johny Feb 14 '14 at 13:51
  • then still the problem might exists... I didn't test in IE8 since it is no longer supported in my project.... can you remove the hidden property for the file control and check – Arun P Johny Feb 14 '14 at 13:59
  • I had looked for a solution for a while... but didn't find any that suits my need.... if you find one please let me know – Arun P Johny Feb 14 '14 at 14:00
  • Sorry, I added some scripts in my question. When I remove the `$('#FileUpload_IE')[0].click();` the `$("#btn_UploadHandler").click();` is working but I need to click the file upload control. – MMakati Feb 14 '14 at 14:03

0 Answers0