实施Dropzone.js并希望有一次性提交后所有的照片被添加到悬浮窗。 这是正确的,现在有WAMP服务器内Kohana的PHP运行。 出于某种原因,我无法将照片传递到PHP页面。
在JS悬浮窗的配置
$(文件)。就绪(函数(){
Dropzone.options.dropzoneForm = {
// The camelized version of the ID of the form element
paramName: "files",
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,
previewsContainer: ".dropzone-previews",
clickable: true,
dictDefaultMessage: 'Add files to upload by clicking or droppng them here.',
addRemoveLinks: true,
acceptedFiles: '.jpg,.pdf,.png,.bmp',
dictInvalidFileType: 'This file type is not supported.',
// The setting up of the dropzone
init: function () {
var myDropzone = this;
$("button[type=submit]").bind("click", function (e) {
e.preventDefault();
e.stopPropagation();
// If the user has selected at least one file, AJAX them over.
if (myDropzone.files.length !== 0) {
myDropzone.processQueue();
// Else just submit the form and move on.
} else {
$('#dropzone-form').submit();
}
});
this.on("successmultiple", function (files, response) {
// After successfully sending the files, submit the form and move on.
$('#dropzone-form').submit();
});
}
}
});
形成
<div id="photoContainer">
<form action="/inspections/uploadphotos" method="post"
enctype="multipart/form-data" class="dropzone dz-clickable dropzone-previews" id="dropzone-form">
</form>
<button type="submit" id="dz" name="dz" value="Submit " /> Submit Photos</button>
</div>
Kohana的PHP
if (!empty($_FILES)) {
print_r($_FILES);
}
问题是,$ _Files总是空的。 任何人都可以提供配置一些这方面的帮助?