2017-05-12 30 views
1

ボタンクリックでファイルをアップロードしようとしています。Dropzone autoProcessQueue:false not working

Upload all files with a button,Dropzone.js post request in laravel 5.4のようなチュートリアルや質問に続きました。しかし成功しなかった。

これは、私のビューファイルのコードである

<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> 

そして、これは、(文書準備ブロックで)私の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. 
     }); 
    } 
}; 

しかし、私は、私のこれは、ファイルブロックが実行されていないJSだと思います。何が問題になるはずですか?

+0

はあなたがコンソールになっているか、エラー、簡単に内容を喜ばことができます。 –

答えて

0

私は同じ状況で落下し、そのコードを発見:

Dropzone.options.myDropzone = { .. } 

がnothinkが役に立つんが。代わりに私が使用します。

Dropzone.forElement(".dropzone").options.autoProcessQueue = false; 

とした後、私はやるキューする必要がある場合:

Dropzone.forElement(".dropzone").processQueue();