felixrieseberg/React-Dropzone-Component

How do I preload images into dropzone.js

Phathdt opened this issue ยท 4 comments

It is programmatically instantiated, as it is part of a larger form. I have it trigged up to process the queue when the form is submitted.

The goal is for my users to be able to use the dropzone to manage images for an item, so when I load my 'models/edit' view for an item, I'd like to preload the dropzone with the images that had previously been uploaded for that item. Is there a good way to implement this so that the already-there items don't get re-uploaded when they submit their changes to the image list?

or just how to have some icon in init with name
then I can you name to remove image from my component's state

danvc commented
var mockFile = { name: "Test.jpg", size: 150312 }; 
myDropzone.options.addedfile.call(myDropzone, mockFile);

Here's more info from the Dropzone.js documentation on creating a mock file: https://github.com/enyo/dropzone/wiki/FAQ#how-to-show-files-already-stored-on-server

And here's how to access the Dropzone object via the React component: https://github.com/felixrieseberg/React-Dropzone-Component#accessing-the-dropzone-object

Also! This issue thread may be helpful: #6