Search code examples
javascriptangularjsangular-file-upload

How to change Header Parameters while using angular-file-upload for uploading multiple files


I have this requirement to add file name in header while uploading each file. I am using a single uploader for selecting multiple files. I tried doing this

 $scope.uploader.onAfterAddingFile = function (fileItem) {
       $scope.uploader.headers.fileName = fileItem.name;
 };

But its not changing. Can anyone please help?


Solution

  • Try with this:

    $scope.uploader.queue[$scope.uploader.queue.length - 1].file.name = "prefix-" + fileItem.file.name;