3

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

1 Answer 1

2

autoQueue does just that: it queues your file when it's added. Since you disabled it, it's not queued.

I think what you are looking for is: autoProcessQueue: false which won't upload the file unless you actually process the queue "manually".

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.