I wrote a function to add files: addCustomFile (file, thumbnail_url, responce)
Works on version: 4.0.1 stable
Proper operation: maxFiles constraint, maxfilesexceeded event, event success and others
$("#dropzone-images").dropzone({
url: "...",
paramName: 'image_temp',
maxFiles: 1,
init: function () {
this.addCustomFile = function(file, thumbnail_url , responce){
this.files.push(file);
this.emit("addedfile", file);
this.emit("thumbnail", file, thumbnail_url);
this.emit("processing", file);
this.emit("success", file, responce , false);
this.emit("complete", file);
}
this.addCustomFile(
{
processing: true,
accepted: true,
name: "The name",
size: 12345,
type: 'image/jpeg',
status: Dropzone.SUCCESS
},
"http://.../img.jpg",
{
status: "success"
}
);
}
});
source
share