角IE9文件上传不工作文件上传、工作

2023-09-13 04:36:55 作者:失心咒

我用这种方式来上传文件:

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" 
  />

在控制器创建fileChanged方法

Create the fileChanged method in the controller

 $scope.fileChanged = function(files) {
     $scope.excelFile = files[0];
 };

它工作在火狐,Chrome IE10,IE11,但在IE9它表明文件是空我们不确定。

It works in FireFox, Chrome IE10, IE11, but in IE9 it shows that the "files is null our undefined".

推荐答案

我上传的图像文件时所面临的同样的问题。它在IE10及更高版本正常工作。低于10的任何版本,文件上传不工作。请参阅此链接

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:文件上传使用angularjs

IE9Issue : File Upload using angularjs