I’m trying to add a file to the multi-file uploader field via JS. I’ve got an image URL and I’m loading the data in. Then I want to add it to one of my form’s fields (I believe this is where I’m stuck). How do I access addFile() of plupload for a specific GF upload field? Or is there another way to turn a url into a file upload while keeping the option for the user to manually upload a file?)
function getImageFromUrl(URL) {
var xhr = new mOxie.XMLHttpRequest();
xhr.open('GET', URL);
xhr.responseType = 'blob';
xhr.onload = function() {
addToGFUploader(this.response);
};
xhr.send();
}
function addToGFUploader(file) {
//how do I access the plupload for #gform_multifile_upload_4_5? Is there a hook I can use?
var uploader = $('#gform_multifile_upload_4_5').plupload('getUploader');
uploader.addFile(file);
}