我使用的是angular- file -upload.js .I想要在一个表单中上传2个图像,2个不同的文件上传和一个表单提交按钮。在我的控制器中:
var uploader = $scope.uploader = $fileUploader.create({
scope: $scope,
url:'upload.php',
autoUpload : true
});
uploader.addToQueue([uploader.queue[0].file]);
uploader.queue[0].upload();amd我的html是:
<input type="file" ng-file-select class="form-control"
ng-model="file_course_thumb_image" accept=".png, .jpg, .jpeg" />
<input type="file" ng-file-select class="form-control"
ng-model="file_course_thumb_image2" accept=".png, .jpg, .jpeg" />尝试上载时,仅上载第二个文件,而不是同时上载第一个和第二个文件。任何建议..
发布于 2017-02-21 15:46:49
我已经通过更改angular-file-upload.js @author Danial @version 1.2.8 .In addToQueue函数添加条件来清空队列,修复了这个问题。
if(this.queue.length == 0) {
this.queue = [] }这样我们就可以在提交表单时上传多张图片。
https://stackoverflow.com/questions/42246369
复制相似问题