Reputation: 9695
I am attempting to programmatically add a File to dropzone.
In the dropzone init event hook:
zoneObject.emit("addedfile", image.file);
zoneObject.emit("thumbnail", image.file, image.url);
zoneObject.files.push(modifiedImage.file);
Which creates a dropzone object that looks like:
But when checking the dropzone's accepted and rejected files, it appears that the file I am trying to add is getting rejected:
I am trying to use dropzone's 'error' event hook to figure out why this rejection is occurring, but this event never gets triggered. Out of all of the Dropzone Events the only one that appears to be triggered in this programatic file upload is 'queuecomplete'
How do I determine what is causing this rejection?
Upvotes: 2
Views: 907
Reputation: 9695
Found a better way to upload an existing file to Dropzone programmatically:
Originally:
zoneObject.emit("addedfile", imageFile);
zoneObject.emit("thumbnail", imageFile, imageUrl);
zoneObject.files.push(file);
Referencing this Dropzone Github Issue I found an easier way to directly upload:
myDropzone.uploadFiles([imageFile])
Unfortunately there are no references to this uploadFiles method in the Dropzone Documentation, so I figured I'd share some knowledge with all you Dropzone users.
Hope this helps someone
Upvotes: 1