dropzone.js在后备上发送到不同的表单处理程序

时间:2015-02-24 12:05:53

标签: php jquery dropzone.js

使用Dropzone.js,有没有办法让后备表单将上传的文件发送到不同的php处理程序?

因此,如果用户使用完整的Dropzone.js界面,则使用" dropzone.php"处理文件上传,但如果用户有旧的和不支持的移植浏览器并且脚本呈现后备模式,那么它使用" dropzonefallback.php"处理文件上传。

我尝试将一个网址硬编码到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);
  }

1 个答案:

答案 0 :(得分:1)

没关系,我想通了!

脚本必须位于&#34;的下半部分;如果&#34;声明,并按照我的要求执行以下操作:

  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);
  }