我正在尝试使用 FlowJS 角度插件来实现上传功能,我需要对其进行一些调整。我将不得不处理所有类型的文件
我正在使用 ASP.NET MVC。
.config(['flowFactoryProvider', function (flowFactoryProvider) {
flowFactoryProvider.defaults = {
target: '',
permanentErrors: [500, 501],
maxChunkRetries: 1,
chunkRetryInterval: 5000,
simultaneousUploads: 1
};
我的输入按钮
<input type="file" flow-btn />
我的上传按钮
<input type="button" ng-click="uploadFiles($flow)">
和功能
$scope.uploadme = function (flows) {
flows.upload();
});
我的 mvc 控制器
[HttpPost]
public string UploadFile(HttpPostedFileBase file)
{
int fileSizeInBytes = file.ContentLength;
MemoryStream target = new MemoryStream();
file.InputStream.CopyTo(target);
byte[] data = target.ToArray();
return "";
}
这很好用,但是当我上传多个文件时,每次都会为一个文件点击控制器。我需要找到一种方法将所有文件一次发送到控制器,比如
public string UploadFile(HttpPostedFileBase[] file)
{
}
我有什么办法可以做到这一点?