1

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.

Jorge Gamba
  • 63
  • 2
  • 6

3 Answers3

3

@srigi

Adding following codes to AngularJS controller:

$scope.$on('fileuploadadd', function(e, data) {
 data.url = '/attachfile?param=test';
});
paulmelnikow
  • 16,895
  • 8
  • 63
  • 114
conghc
  • 31
  • 2
  • This seems like a hack to me. What if url needs to be set as the result of an async call? In that case, the user interaction might occur before the URL is set. The angular plugin for fileupload watches for option changes (line 337 of version 2.0.1), but I don't know how to get to it. – Tony K. Nov 13 '13 at 20:03
0

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

Jorge Gamba
  • 63
  • 2
  • 6
  • Can you please provide more complete answer? Where did you "hooked" to that data attribute. There is no add() callback in angular example code. Everything is handled in "Angular way" using scopes & Controllers. – srigi Oct 02 '13 at 13:02
0

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

file-upload='uploadOptions'

JS:

$scope.uploadOptions = {
    url: yourDynamicUrl
}
Community
  • 1
  • 1
Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169