Using DropzoneJS v4.0.
Below are the options that are set for the dropzone.
Dropzone.options.myDropzone = {
acceptedFiles: '.jpg,.jpeg,.png',
addRemoveLinks: true,
autoQueue: false,
clickable: false,
maxFiles: 1,
maxThumbnailFilesize: 2000,
parallelUploads: 10,
thumbnailWidth: null,
thumbnailHeight: null,
init: function() {
var dropzone = this;
dropzone.on("addedfile", function(file) {
if (!file.type.match(/image.*/)) {
dropzone.removeFile(file);
}else {
function();
}
});
dropzone.on("maxfilesexceeded", function(file) {
dropzone.removeFile(file);
});
dropzone.on("removedfile", function(){
if($('#imgEditor').find('img').length == 0) {
$('.overlay').remove();
$('#cropper').remove();
$('#upload').remove();
}
});
$(document).on('click', '#upload', function(){
dropzone.processQueue();
});
}
};
When I click the upload button that is dynamically generated from the function()
in the addedfile
event nothing happens. Checking dropzone.getAcceptedFiles().length
returns the number of files in the dropzone, but checking dropzone.getQueuedFiles().length
returns 0. No files have been uploaded or have triggered an upload and the file types are valid file types.
I need help understanding why a file would be considered accepted, but not queued. I haven't found documentation explaining a difference if there is any and in the code it looks like if a file is accepted it is supposed to be queued, but this is not the case. So I know why processQueue
actually fails I just don't know why queueing is failing.
Changing autoQueue
to true allows the file to be uploaded correctly, but this is not the desired affect. Please see Enyo FAQ Dropzone Submit Button.
Git #989