我使用了另一種形式的內首次dropzone.js ......這樣兩種形式不能嵌套,我刪除了懸浮窗的形式:麻煩與dropzone.js文件上傳
HTML片段:
<form id="addproduct" name="addproduct" action="receiveAddForm" method="post" enctype="multipart/form-data">
<fieldset class="form-horizontal">
<div class="form-group">
<div class="col-sm-2">
<small class="text-navy"><b>* Campos Obligatorios</b></small>
</div>
</div>
<div class="form-group"><label class="col-sm-2 control-label">Nombre (Modelo) *:</label>
<div class="col-sm-10"><input name="name" type="text" class="form-control"></div>
</div>
</fieldset>
<div class="dropzone dropzone-previews" id="my-awesome-dropzone"></div>
</form>
JS片段:
Dropzone.options.myAwesomeDropzone = {
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 3,
addRemoveLinks: true,
maxFilesize: 10,
url: 'receiveAddForm',
init: function() {
var myDropzone = this;
$("#submit_form").click(function (e) {
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
});
this.on("sendingmultiple", function() {
});
this.on("successmultiple", function(files, response) {
});
this.on("errormultiple", function(files, response) {
});
this.on("maxfilesexceeded", function(file){
// alert("No more files please!");
});
this.on("uploadprogress", function(file, progress) {
console.log("File progress", progress);
});
}
}
所以在服務器端,我呼應後得到這個$ _FILES:
array (size=1)
'files' =>
array (size=5)
'name' => string '' (length=0)
'type' => string '' (length=0)
'tmp_name' => string '' (length=0)
'error' => int 4
'size' => int 0
這裏似乎是什麼問題?我的php.ini設置爲1000MB上傳最大文件大小,內存限制等......任何幫助將被讚賞!
你可以嘗試在表單中添加'calss =「dropzone」'並查看它是否有效? – Musa
你如何提交表格?我沒有在html中看到'#submit_form'元素。 – wallek876
@ wallek876該按鈕不在表格 – Limon