1

我在 IE 中使用 Dojo 1.6 dojox.form.Uploader。这使用 dojox.form.uploader.plugins.Flash 插件进行上传。在 Firefox 中,使用 HTML5,我可以通过调用以下方式提交其他表单数据以及上传:

uploaderDijit.upload({paramName:"paramValue"});

但是在 IE 中,Flash 版本的上传函数不带 formData 参数。有什么方法可以使用 Flash 插件提交其他数据以及文件上传?

这是我的示例代码:

dojo.require("dojox.form.Uploader");
dojo.require("dojox.form.uploader.FileList");
dojo.require("dojox.form.uploader.plugins.Flash");

function doUpload(){
     dijit.byId("uploader").upload({param: "paramValue"});
}

function onload(){
     // create uploader & file list dijits
     var uploaderDijit = new dojox.form.Uploader({
          id: "uploader",
          url: "MyApp/MyServlet",
          multiple: true
     });
     var fileListDijit = new dojox.form.uploader.FileList({uploader:uploaderDijit});

     // insert dijits into html
     var formNode = dojo.byId("multiUploadForm");
     var uploaderDiv = document.createElement("div");
     formNode.appendChild(uploaderDiv);
     uploaderDiv.appendChild(uploaderDijit.domNode);
     uploaderDiv.appendChild(fileListDijit.domNode);
}

dojo.addOnLoad(onload);

和:

<form id="multiUploadForm" method="post" enctype="multipart/form-data" encoding="multipart/form-data"></form>
<button onclick="javascript:doUpload();">Upload</button>

我尝试在表单中添加一个输入节点:

<form id="multiUploadForm" method="post" enctype="multipart/form-data" encoding="multipart/form-data">
     <input type="hidden" name="param" value="paramValue"/>
</form>

而且我还尝试将参数附加到 url,但没有骰子:

var uploaderDijit = new dojox.form.Uploader({
     id: "uploader",
     url: "MyApp/MyServlet?param=paramValue",
     multiple: true
});
4

1 回答 1

0

我相信还有其他问题。以下是(尽管来自 1.7.2 src)您所调用的函数是您在第一个代码块中的入口点。100% 确定,如果您使用url: "MyApp/MyServlet?param=paramValue" .

uploadFlash: function(/*Object ? */formData){
        // summary:
        //              Uploads selected files. Alias "upload()" should be used instead.
        // tags:
        //              private
        this.onBegin(this.getFileList());
        formData.returnType = "F";
        this.flashMovie.doUpload(formData);
},
于 2012-05-13T11:14:43.470 回答