Jorge Gamba
Jorge Gamba

Reputation: 63

How to change dynamically the upload (jquery-file-upload) url using $scope?

I'm using the jquery-file-upload how describes http://css.dzone.com/articles/angularjs-file-upload but aditionally I need to send a parameter via query string, so I need to change that parameter according to a select option change, which value is in $scope.

So how can I to achieve this? thanks in advance.

Upvotes: 1

Views: 3662

Answers (3)

Răzvan Flavius Panda
Răzvan Flavius Panda

Reputation: 22116

HTML (same as here: https://stackoverflow.com/a/18580266/750216):

file-upload='uploadOptions'

JS:

$scope.uploadOptions = {
    url: yourDynamicUrl
}

Upvotes: 0

conghc
conghc

Reputation: 31

@srigi

Adding following codes to AngularJS controller:

$scope.$on('fileuploadadd', function(e, data) {
 data.url = '/attachfile?param=test';
});

Upvotes: 3

Jorge Gamba
Jorge Gamba

Reputation: 63

I found a solution using the 'data' parameter in a event of the jquery file upload, in https://github.com/blueimp/jQuery-File-Upload/issues/355

Upvotes: 0

Related Questions