Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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?

share|improve this question
up vote 3 down vote accepted

Try with this:

$scope.uploader.queue[$scope.uploader.queue.length - 1].file.name = "prefix-" + fileItem.file.name;
share|improve this answer
    
i want to add the new parameter in header itself – mulla.azzi Jul 14 '15 at 14:27
    
Try to set in headers for that object param like: uploader.queue[uploader.queue.length - 1].headers.newParam = fileItem.file.name; – mlivan Jul 14 '15 at 14:44
    
Thanks... It worked for me.. :) – mulla.azzi Jul 15 '15 at 7:48

This should work:

$scope.uploader.onBeforeUploadItem = function (fileItem) {    
  fileItem.headers = {
    fileName: fileItem.name
  };
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.