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.

3 Answers 3

3

@srigi

Adding following codes to AngularJS controller:

$scope.$on('fileuploadadd', function(e, data) {
 data.url = '/attachfile?param=test';
});
Sign up to request clarification or add additional context in comments.

1 Comment

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.
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

1 Comment

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.
0

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

file-upload='uploadOptions'

JS:

$scope.uploadOptions = {
    url: yourDynamicUrl
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.