I am trying to use FlowJS angular plugin for a upload functionality and I need to tweak it a little. I will have to files of all types
I am using ASP.NET MVC.
.config(['flowFactoryProvider', function (flowFactoryProvider) {
flowFactoryProvider.defaults = {
target: '',
permanentErrors: [500, 501],
maxChunkRetries: 1,
chunkRetryInterval: 5000,
simultaneousUploads: 1
};
My input button
<input type="file" flow-btn />
My upload button
<input type="button" ng-click="uploadFiles($flow)">
And the function
$scope.uploadme = function (flows) {
flows.upload();
});
My mvc controller
[HttpPost]
public string UploadFile(HttpPostedFileBase file)
{
int fileSizeInBytes = file.ContentLength;
MemoryStream target = new MemoryStream();
file.InputStream.CopyTo(target);
byte[] data = target.ToArray();
return "";
}
This works fine, but when I upload multiple files, the controller is hit every time for a file. I need to find a way to send all files to the controller at once, some thing like
public string UploadFile(HttpPostedFileBase[] file)
{
}
Any ways I can achieve this ?
input type filefrom where you select files for upload ?Request.Filescollection?Requestobject inside your mvc controller. It has property calledFiles. Try to see it and also you don't need to specify input parameter for your method. You should see all your uploaded files inRequest.Filescollection