Dropzone autoProcessQueue: false 不起作用

Key*_*r K 2 jquery dropzone.js laravel-5.4

我正在尝试通过单击按钮上传文件。

我按照像,这么多的教程/问题, 上载一个按钮的所有文件在laravel 5.4 Dropzone.js POST请求。但没有获得成功。

这是我的视图文件代码,

<form action="{{ url('admin/candidate/file-upload') }}" method="post" class="dropzone" id="my-dropzone">
    {{ csrf_field() }}
    <div class="dz-message">
        <h3>Drop images here or click to upload.</h3>
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

这是我的 JS 文件代码(在文档就绪块中),

//DropZone - Drag and drop file upload
Dropzone.options.myDropzone = {
    // Prevents Dropzone from uploading dropped files immediately
    autoProcessQueue: false,

    init: function () {
        var submitButton = document.querySelector("#submit-all")
        myDropzone = this; // closure

        submitButton.addEventListener("click", function () {
            myDropzone.processQueue(); // Tell Dropzone to process all queued files.
        });
        // You might want to show the submit button only when 
        // files are dropped here:
        this.on("addedfile", function () {
            // Show submit button here and/or inform user to click it.
        });
    }
};
Run Code Online (Sandbox Code Playgroud)

但我认为我的这个 js 文件块没有执行。应该是什么问题?

小智 5

我遇到了同样的情况并发现了该代码:

Dropzone.options.myDropzone = { .. }
Run Code Online (Sandbox Code Playgroud)

不觉得有用。相反,我使用:

Dropzone.forElement(".dropzone").options.autoProcessQueue = false;
Run Code Online (Sandbox Code Playgroud)

之后,当我需要排队时,我会这样做:

Dropzone.forElement(".dropzone").processQueue();
Run Code Online (Sandbox Code Playgroud)