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

Issue

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;

Answered By – mlivan

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.