다음은 dropzone 옵션에 대한 코드입니다. 한 번에 2 개의 파일을 업로드하고 총 5 개의 파일을 업로드한다고 가정하면 해당 드롭 존에 5 개 이상의 파일을 업로드하면 maxfileexceeded 오류 메시지가 표시됩니다. 내가 요구하는 것은 사용자가 한 번에 2 개 이상의 파일을 업로드하려고하면 메시지가 표시되고 다른 파일은 제거되어야한다는 것입니다.
Dropzone.options.dropzone =
{
maxFilesize: 2,
maxFiles: 5,
autoProcessQueue: true,
parallelUploads: 2,
renameFile: function(file) {
var dt = new Date();
var time = dt.getTime();
return time+file.name;
},
acceptedFiles: ".jpeg,.jpg,.png,.gif,.pdf",
addRemoveLinks: false,
timeout: 300000,
error: function(file, response)
{
return response;
},
init: function() {
this.on("maxfilesexceeded", function(file){
this.removeFile(file);
showAlert("File Limit exceeded!","error");
});
}
};
내 Dropzone
<form method="post" action="{{url('/saveEventFile')}}" enctype="multipart/form-data"
class="dropzone" id="dropzone">
@csrf
</form>
아마도 이것은 당신이 이벤트를 추가 autoQueue
하도록 설정했을 때 작동합니다 false
.addedfile
Dropzone.options.dropzone =
{
maxFilesize: 2,
maxFiles: 5,
autoQueue:false,
autoProcessQueue: true,
parallelUploads: 2,
renameFile: function(file) {
var dt = new Date();
var time = dt.getTime();
return time+file.name;
},
acceptedFiles: ".jpeg,.jpg,.png,.gif,.pdf",
addRemoveLinks: false,
timeout: 300000,
error: function(file, response)
{
return response;
},
init: function() {
this.on("maxfilesexceeded", function(file){
this.removeFile(file);
showAlert("File Limit exceeded!","error");
});
this.on("addedfile", function(file) { if(this.files.length<=2){enqueueFile(file);} this.processQueue();});
}
};
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다