2017-05-12 2 views
1

버튼 클릭시 파일을 업로드하려고합니다.Dropzone autoProcessQueue : false가 작동하지 않습니다.

저는 많은 튜토리얼/질문 ( 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(); 
관련 문제