dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: IE does not work, but Chrome does

  1. #1
    Join Date
    Feb 2014
    Posts
    1

    Question IE does not work, but Chrome does

    Hi All,

    I have the following input:

    <input id="btnFile" type="file" name="files[]" multiple>

    And here is the simple javascript function

    $("#btnFile").on('change', function (event, files, label)
    {
    var lstFiles = $("#btnFile")[0].files;
    ...
    });


    The above code works fine with Chrome. It return an array for files that can be manipulated. However, in IE, I can pick only ONE file, and the lstFiles is NULL.

    Do you know what is wrong with IE (settings???). Can someone shed a light?

    Thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,589
    That code is some sort of framework, please ask in the JavaScript Frameworks forum.
    If your post falls off the page, bump it. ...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Feb 2014
    Location
    Canada
    Posts
    155
    You're almost there. Try the following:

    Code:
    var myFile = $(#btnFile)[0].files[0];
    Keep in mind, it's fairly new meaning older browsers may not support it or require a workaround. Same story with JavaScript. If you're not using a HTML5 doctype, it definitely will not work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles