In my Vue.js project, I am using dropzone with the maxFiles: 1
option set. To display an existing file from the server in dropzone, I have added the following code:
let mockFile = { name: 'Filename', size: file.size };
myDropzone.emit('addedfile', mockFile);
myDropzone.emit('thumbnail', mockFile, file.dataURL);
myDropzone.emit('success', mockFile);
myDropzone.emit('complete', mockFile);
myDropzone.files.push(file);
The above code successfully adds the file to the dropzone. However, when additional files are manually added to the dropzone, the maxfilesexceeded
event is not triggered.
It should be noted that if files are added manually (rather than programmatically), the maxfilesexceeded
event does get triggered.