I would like to upload one file at a time, while allowing multiple files to be dragged/selected at once. Is there a way to do this? It seems that using a promise might be the way to go, but, having never used promises before, I am not sure.
Right now, I have this code:
for (var i = 0, len = $scope.files.length; i < len; i++)
{
var file = $scope.files[i];
file.progress = 0;
Upload.upload({
url: '/file-upload',
fields: {},
file: file
}).progress(function (e) {
file.progress = parseInt(100.0 * e.loaded / e.total) + '%';
}).success(function (data, status, headers, config) {
file.progress = 100;
});
}