简体   繁体   中英

dropzone.js autoprocessqueue:false don't work

I try to use a button to submit my download. I am following the introduction of this guide .

This is my path:

<form action="index.php/controller/upload" class="dropzone" id="my-dropzone"></form>

and this is my upload function:

public function upload() {
        if (!empty($_FILES)) {
            $tempFile = $_FILES['file']['tmp_name'];
            $fileName = 'test.csv';
            $targetPath = getcwd() . '/application/models/uploads/';
            $targetFile = $targetPath . $fileName;
            move_uploaded_file($tempFile, $targetFile);
        }
    }

just standard stuff but what am I missing? Because it is still uploading instantly.

you can edit my dropzone function to your needs

var QuoteDropzone = new Dropzone('#quote_upload', {
 init: function () {
    var dropzone = this;
    $("#removeAllFiles").click(function () {
        dropzone.removeAllFiles();
    });

    $('#quote_upload_submit').click(function () {
        QuoteDropzone.processQueue();
    });
},
parallelUploads: 20,
url: "/quotes/quote-upload",
autoProcessQueue: false,
type: 'POST',
success: function () {
    toastr.success('<h3>Success</h3><p>Files Uploaded</p>');
},
error: function() {
    toastr.error('<h3>Error</h3><p>Files Not Uploaded</p>');
}
});

will help you more tonight if you still have a problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM