how to prepopulate properly #1998
Unanswered
parmentelat
asked this question in
Q&A
Replies: 1 comment
|
Hey @parmentelat, try to push your mock files to Example: let file = {
name: 'Upload.jpg',
size: myFileSize,
accepted: true
};
dropzone.displayExistingFile(file, myFileData);
dropzone.files.push(file); |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Duplicating issue #1991 after realizing that issues were not the right channel to use
Hi; I'm looking at dropzone for the first time
the tool looks great but I have some trouble understanding one thing
my use case is to start the dropzone with the contents of an existing folder; so my backend sends in
droppedsprimarily a list of{relpath, bytes_size}objectsI found the following recipe to prepopulate the dropzone from that info, using something like
this kind of works, except that....
I tried to write some code to deal with duplicates
(turns out, in my case, I want to allow duplicates to be uploaded and to overwrite any previous content, so I need to tweak the default behaviour that would create duplicate thunbnails in the dropzone)
and that's when I realized that the 2 kinds of files (the prepopulated ones, vs the ones I upload after the dropzone is created) are managed very differently
and in particular in
dropzone.filesI can only find the ones uploaded after the dropzone is created(so to be specific, imagine I create the dropzone with 2 pre-existing files, and then I upload 3 new files, the
dropzone.filesattribute will contain only 3 entries)how can I access the pre-populated entries in this kind of case ? I've inspected the structures manually and could not find where the prepopulated file stubs get stored ?
less importantly, there is also a visual difference in that the pre-existing entries won't have a 'remove file' link; but here I expect maybe it's simply a matter of passing some more data in my
mock_filevariable above ?in any case, I feel like I might not be using the library as it is intended to be used, or I am missing something ?
thanks in advance for shedding some more light on how that's all supposed to work !
All reactions