I have a page with an uploader (http://www.dropzonejs.com) at the top of the page. Directly under it I have a list of files that are currently in my ‘upload’ directory. I would like to update the list if files when a file has been uploaded successfully using Dropdown’s success event.
This is what I have so far.
Ember.$("div#my-awesome-dropzone").dropzone({
url: "http://localhost:3000",
addRemoveLinks: true,
previewContainer: true,
drop: function(event, err) {
console.log('dropped');
},
sending: function(file, xhr, formData) {
console.log('SENDING: ');
console.log(file);
Ember.$("<span id='123'></span><span>%</span>").appendTo(".dz-details");
},
uploadprogress: function(file, progress, err) {
Ember.$('#123').text(Math.round(progress));
},
success: function(file, res) {
console.log(file.name + ' successfully uploaded');
console.log(res);
// HOW CAN I UPDATE MY LIST OF FILES HERE?
}
});
I’m using Dropzone.js as my uploader. The model hook in my route returns a list of files in my ‘upload’ directory on the server. So what I’m attempting to do is…after a file is successfully uploaded, update my list of files.