使用Dropzone.js,有没有办法让回退表单将上传的文件发送到不同的php处理程序?
因此,如果用户使用完整的Dropzone.js界面,它会使用"Dropzone.php"来处理文件上传,但如果用户有一个旧的、未移植的浏览器,并且脚本以回退模式呈现,那么它会使用"dropzonefallback.php"来处理文件上载。
我试着将一个url硬编码到dropzone.js中的回退表单代码中,但这不起作用:
if (this.element.tagName !== "FORM") {
form = Dropzone.createElement("<form action='"dropzonefallback.php'" enctype='"multipart/form-data'" method='"" + this.options.method + "'"></form>");
form.appendChild(fields);
} else {
this.element.setAttribute("enctype", "multipart/form-data");
this.element.setAttribute("method", this.options.method);
}
没关系,我想好了!
脚本一定在"if"语句的下半部分,并且按照我的意愿执行以下操作:
if (this.element.tagName !== "FORM") {
form = Dropzone.createElement("<form action='"dropzonefallback.php'" enctype='"multipart/form-data'" method='"" + this.options.method + "'"></form>");
form.appendChild(fields);
} else {
this.element.setAttribute("action", "dropzonefallback.php");
this.element.setAttribute("enctype", "multipart/form-data");
this.element.setAttribute("method", this.options.method);
}