파일 업로드에 dropzone을 사용하고 있습니다. 한 번에 하나의 이미지를 업로드하는 경우 파일 제한을 최대 6 개까지 설정할 수 있지만이 이미지를 6 개 이상 선택하면이 코드가 작동합니다 파일 업로드 시작시 컨트롤 버튼을 누르면 파일의 유효성을 검사하지 않고 모든 파일을 업로드합니다. 내가 백엔드 laravel을 사용하고, 내 코드는 다음과 같습니다 -Dropzone이 최대 파일 수를 확인하지 않음
Dropzone.options.myAwesomeDropzone = {
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 1, // MB
maxFiles: 6,
acceptedFiles: ".jpeg,.jpg,.png,.gif",
clickable: true,
init: function() {
this.on("success", function(file, responseText) {
file.previewTemplate.setAttribute('id',responseText[0].id);
});
this.on("thumbnail", function(file) {
if (file.width < 350 || file.height < 200) {
file.rejectDimensions()
}
else {
file.acceptDimensions();
}
});
},
accept: function(file, done) {
file.acceptDimensions = done;
file.rejectDimensions = function() { done("Image width or height should be greater than 350*200"); };
},
removedfile: function(file){
var name = file.name;
$.ajax({
type: 'POST',
url: ajax_url+'listing/deleteListingImage/'+name,
dataType: 'html'
});
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
},
dictDefaultMessage: "Drop your files to upload"
}
감사
A.은'console'의 모든 오류? B. [docs about it] (http://www.dropzonejs.com/#config-maxFiles)을 읽으셨습니까? 그것은 유효하지 않습니다. 그냥 'maxfilesexceeded'이벤트를 호출하는 것입니다. –
그것의 유효화 벌금 유일한 문제는 내가 6 개 이상의 이미지를 한 번에 업로드하는 경우입니다 –
또한 콘솔에서 오류를주지 마십시오 –