I use this way to upload file:
<input type="file"
name="upload-file"
ng-model= "excelFile"
accept=".xlsx"
onchange="angular.element(this).scope().fileChanged(this);"
required="true"
/>
Create the fileChanged method in the controller
$scope.fileChanged = function(files) {
$scope.excelFile = files[0];
};
It works in FireFox, Chrome IE10, IE11, but in IE9 it shows that the "files is null our undefined".
I faced the same issue when uploading image files. It worked fine in IE10 and later versions. Any version below 10 , file upload is not working. Refer this link
IE9Issue : File Upload using AngularJS
There is no way to use IE9 and below with the your method. You have two possible ways: 1. Use Flash uploader in case of IE9 and lower. Try to avoid this scenario 2. Use the http://malsup.com/jquery/form/ which will give you "some sort" of file access, as HTML 5 does :)
As mentioned any method of file upload that uses FormData and File API stuff won't work in IE9 as they aren't available until IE10.
However, two angular modules that have a fallback method that will work with IE9 for uploading files that I know of are:
I am using nervgh/angular-file-upload as it does not require Flash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With