php获取dropzone上传的文件,php – 我可以使用Dropzone提交表单而无需上传任何文件吗?...

我遵循了

Combine Dropzone With Normal Form教程,允许Dropzone上传和放大表格提交.表格是申请表格,应该与&没有添加文件.目前,仅当将一个或多个文件添加到Dropzone时,它才有效.

是否有一个选项我可以允许Dropzone处理表单提交,即使上传队列为空?

以下是我初始化表单的方法:

Dropzone.options.general = {

paramName: 'tx_ddapplicationform_applicationformgeneral[form][files]', // The name that will be used to transfer the file

autoProcessQueue: false,

uploadMultiple: true,

parallelUploads: 100,

maxFiles: 100,

addRemoveLinks: true,

previewsContainer: '.dropzone-previews', // we specify on which div id we must show the files

clickable: false,

// The setting up of the dropzone

init: function() {

var myDropzone = this;

console.log(myDropzone)

console.log("Dropzone init");

console.log(this.element.querySelector("input[type=submit]"))

// First change the button to actually tell Dropzone to process the queue.

this.element.querySelector("input[type=submit]").addEventListener("click", function(e) {

// Make sure that the form isn't actually being sent.

console.log("the button is clicked")

e.preventDefault();

e.stopPropagation();

myDropzone.processQueue();

console.log("after processQueue")

});

// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead

// of the sending event because uploadMultiple is set to true.

this.on("sendingmultiple", function() {

console.log("sending multiple");

});

this.on("successmultiple", function(files, response) {

console.log("success multiple");

});

this.on("errormultiple", function(files, response) {

console.log("error multiple");

});

}

我浏览了dropzone.js表单并添加了console.logs来查看发生了什么.成功提交(添加了文件)记录下:

processQueue dropzone.js:1301

upload multiple dropzone.js:1314

sending multiple main.jquery.js:551

after processQueue main.jquery.js:545

success multiple main.jquery.js:554

没有附加文件的不成功提交会记录下:

processQueue dropzone.js:1301

after processQueue main.jquery.js:545

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值