0

I try to modify my upload with jQuery (replace the input file button). This code works fine on FF and Chrome but Internet Explorer do not submit the form? Why not? There are no errors shown in developer tools. jQuery Version is 1.10.2. Internet Explorer 10. Some source:

    <form action="http://localhost/....." method="post" 
       accept-charset="utf-8" id="item_document_form" 
       enctype="multipart/form-data">
       <input type="file" name="userfile" id="userfile" style="display: none;" />
    </form> 
    <button id="add_file_btn">Upload file</button>

and the relevant script:

    $("#add_file_btn").button();
    $("#add_file_btn").click(function() {
        $("#userfile").click();
    });
    $("#userfile").change(function () {
        $('#ajaxupload').fadeIn();
        $("#item_document_form").submit();
    });
fillibuster
  • 698
  • 4
  • 16
  • 33
  • 3
    obviously question but are there any js errors in IE? or any browser for that matter? – Jamie Hutber Jul 10 '13 at 07:33
  • 4
    Perhaps your issue isn't the submit() event, but the change() event? See: http://stackoverflow.com/questions/2389341/jquery-change-event-to-input-file-on-ie – CodingIntrigue Jul 10 '13 at 07:38
  • It's because the change() event. I get "access denied error. check it out here http://jsfiddle.net/wewdq/ – Stasel Jul 10 '13 at 07:41
  • Hi, the change event is rised alert($("#userfile").val()); give the expected value! There are no errors. IE is v10. – fillibuster Jul 10 '13 at 07:54
  • How about `$('#form').get(0).submit()`? Also, could you provide a jsfiddle or something? – Mosselman Jul 10 '13 at 08:23
  • @Mosselman - I get SCRIPT5: access denied if I use $('#form').get(0).submit() – fillibuster Jul 10 '13 at 08:42
  • @grolle: http://stackoverflow.com/questions/5087549/access-denied-to-jquery-script-on-ie – Mosselman Jul 10 '13 at 09:25
  • @Mosselman yes, I read this thread, but I don't use any different domain on the whole page :-( and no Ajax calls – fillibuster Jul 10 '13 at 09:38
  • @grolle, can you setup a fiddle where you produce the same error? – Mosselman Jul 10 '13 at 09:57
  • In the fiddle, there is a problem with the file dialog in IE: http://jsfiddle.net/VBp5H/1/ the oriiginal is a revealing module: http://jsfiddle.net/VBp5H/ – fillibuster Jul 10 '13 at 11:20
  • It is a great question, I am also dealing with same issue, those who have marked it as duplicate are morons, question is file upload doesn't work on IE, and I also have same issue. – abdulrafique Jul 24 '18 at 08:22

0 Answers0