Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting URL after creating FileUploader doesn't work #589

Closed
felipedrumond opened this issue Feb 12, 2016 · 3 comments
Closed

Setting URL after creating FileUploader doesn't work #589

felipedrumond opened this issue Feb 12, 2016 · 3 comments

Comments

@felipedrumond
Copy link

When creating a FileUploader with

$scope.uploader = new FileUploader({
            headers: {
                SecurityToken: credentials.securityToken
            }
        });

and setting the url afterwards with

$scope.uploader.url = url;

does not work. I need to change the URL depending on a input . How to solve this issue?

@WilliamChelman
Copy link

Do you already have a file in your uploader queue when you do $scope.uploader.url = url;?
If so, for what I understand, setting the url of the uploader doesn't update the url of the pre-existing files in the queue, so you have to manually update them. For example I use a function like this:

this.updateUrl = function(url, uploader) {
  uploader.url = url;
  uploader.queue.forEach(function(file) {
    file.url = url;
  });
};

@josencv
Copy link
Collaborator

josencv commented Feb 26, 2016

You can also use a file handler like onAfterAddingFile to set the url:

$scope.uploader.onAfterAddingFile = function(item) {
  item.url = url;
}

@nervgh
Copy link
Owner

nervgh commented May 15, 2016

You could use the onBeforeUploadItem callback.
Also you could implement the setOptions method.

@nervgh nervgh closed this as completed May 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants