当有超过1个单独的文件上载字段时,文件无法上传

时间:2017-01-13 10:39:54

标签: angularjs

有人可以告诉我为什么我的选定文件没有通过AngularJS传递并被PHP捕获?

我正在使用此插件来处理https://github.com/danialfarid/ng-file-upload

当我执行var_dump($_FILES)时,它始终显示为空

HTML

<form enctype="multipart/form-data" method="post">
 <div class="form-group">
    <input type="text" class="form-control" ng-model="subject" required>
  </div>

<div class="form-group">
    <input type="file" class="form-control" ngf-select="" ng-model="cv" required>
 </div>

<div class="form-group">
    <input type="file" class="form-control" ngf-select="" ng-model="photo" required>
 </div>

<div class="form-group">
    <input type="file" class="form-control" ngf-select="" ng-model="voice" required>
 </div>

<button type="submit" class="btn btn-default" ng-click="sendfiles(cv,photp,voice)">Submit</button>
</form>

JS

angular.module('uploadApp', ['ngFileUpload']);

var appCtrl= [ '$scope', 'Upload', function($scope, Upload) {

  $scope.sendfiles= function(file1,file2,file3) {

Upload.upload({
    url: 'uploading.php', 
    method: 'POST',
    file: [file1,file2,file3],
    data: {
        'subject': $scope.subject,
         }
      })

  };
}];

0 个答案:

没有答案