-
How do I make previously uploaded files appear in the Dropzone when the page loads. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
In short: use Dropzone.options.myDropzone = {
init: function() {
let myDropzone = this;
// If you only have access to the original image sizes on your server,
// and want to resize them in the browser:
let mockFile = { name: "Filename 2", size: 12345 };
myDropzone.displayExistingFile(mockFile, "https://i.picsum.photos/id/959/600/600.jpg");
// If the thumbnail is already in the right size on your server:
let mockFile = { name: "Filename", size: 12345 };
let callback = null; // Optional callback when it's done
let crossOrigin = null; // Added to the `img` tag for crossOrigin handling
let resizeThumbnail = false; // Tells Dropzone whether it should resize the image first
myDropzone.displayExistingFile(mockFile, "https://i.picsum.photos/id/959/120/120.jpg", callback, crossOrigin, resizeThumbnail);
// If you use the maxFiles option, make sure you adjust it to the
// correct amount:
let fileCountOnServer = 2; // The number of files already uploaded
myDropzone.options.maxFiles = myDropzone.options.maxFiles - fileCountOnServer;
}
}; |
Beta Was this translation helpful? Give feedback.
-
Changing |
Beta Was this translation helpful? Give feedback.
-
I am using v6.0.0-beta.2 and this is the working solution for me:
Hope this helps:) |
Beta Was this translation helpful? Give feedback.
In short: use
myDropzone.displayExistingFile()
.