0

I cant get files from input file on IE9/8. 10 works.

<input type="file" file-model="onFileSelected($files)" />

app.directive('fileModel', ['$parse', function ($parse) {
    return {
        restrict: 'A',

        link: function(scope, element, attrs) {           
            var fn = $parse(attrs["fileModel"]);
            element.on('change', function(e) {
                console.log(e.target.files);
            })
        }
    };
}]);

e.target.files is undefined on IE9

corneliusz
  • 108
  • 1
  • 9
  • Possible duplicates: http://stackoverflow.com/questions/12830058/ie8-input-type-file-get-files http://stackoverflow.com/questions/6207388/is-it-possible-to-select-and-upload-multiple-files-at-one-time-in-internet-explo – Taylor Buchanan Nov 06 '14 at 12:59

1 Answers1

0

This question has already been answered here and here.

However, may I recommend you take a look at angular-file-upload. If you need to upload multiple files at once, it handles the abstraction of the file input for most browsers by using a flash shim.

Community
  • 1
  • 1
Taylor Buchanan
  • 4,155
  • 1
  • 28
  • 40