Reputation: 1
I have a form that is submitting files via ajax to a restful API. In order to do this I am using Hayageeks jQuery Upload File Plugin.
The script is working fine except for when I need one of the settings (the URL), to be changed after initialization. The route will be different for each file depending upon what menu selections are chosen by the user.
Initialization when document is ready:
$(function(){
var settings = {
url: "default_url",
autoSubmit:false
}
uploadObj = $("#mulitplefileuploader").uploadFile(settings);
});
Event where I want the url to be set:
$("#btnSubmit").on('click', function() {
uploadObj.uploadFile(
url: "new_url"
);
uploadObj.startUpload();
});
What do I need to do in order for this to work?
Upvotes: 0
Views: 190
Reputation: 1
I found out that the plugin has an update method that accepts new settings at runtime.
uploadObj.update({url:newUrl,maxFileCount:3,showDownload:false});
I was only able to get this to work in an onchange event though, for some reason it wouldn't work with the click event.
Upvotes: 0
Reputation: 9929
You need to call $("#mulitplefileuploader").uploadFile(settings);
again with the new settings.
Upvotes: 1