I have this working example of Dropzone, but I am trying to add a previously uploaded image that I have on my server. The part where “init” starts is where the issue is. It does not like the “thisDropzone.displayExistingFile”. I think that i need to use dropzone.options, but I cannot seem to bind that to a DIV.
Any thoughts? I could not find any full working examples on their gitlab or website, which I thought was weird so any help would be appreciated! thank you.
$("div#my-awesome-dropzone").dropzone({
url: "/data/upload.php",
maxFilesize: 1,
thumbnailHeight: 100,
thumbnailWidth: 100,
addRemoveLinks: true,
success: function (file, response) {
var imgName = response;
file.previewElement.classList.add("dz-success");
console.log("Successfully uploaded :" + imgName);
},
error: function (file, response) {
file.previewElement.classList.add("dz-error");
},
init: function() {
thisDropzone = this;
var mockFile = { name: "Filename 2", size: 12345 };
thisDropzone.displayExistingFile(mockFile, "https://www.link-to-image/myimage.jpg");
alert("test")
}
});
I have been playing around with this for hours. It has something to do with the way I am calling the init, I just cannot find an example of hour to do this and bind it to my DIV.
Dennis Gaudenzi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.