When working on my project, I came across a helpful module that I use from https://github.com/nervgh/angular-file-upload. It functions well when the URL is set during initialization. However, I encountered an issue when trying to change the URL after the image was initialized but before it was uploaded.
$scope.uploader = new FileUploader({
url: '/default_url/' //set default url
});
$scope.changeURL = function(){
// Despite my efforts, changing the URL directly does not work as expected
$scope.uploader.url = '/new_cool_url/';
// Following the recommended method from the FAQ
$scope.uploader.onBeforeUploadItem(function(item) {
item.url = '/new_cool_url/';
} );
$scope.uploader.uploadAll(); // Still uploading to default_url
};