I’m using the Dojo 1.6 dojox.form.Uploader in IE. This uses the dojox.form.uploader.plugins.Flash plugin to do the upload. In Firefox, HTML5 is used and I can submit other form data along with the uploads by calling:
uploaderDijit.upload({paramName:"paramValue"});
But in IE, the Flash version’s upload function does not take the formData argument. Is there any way I can submit other data along with the file uploads using the Flash plugin?
Here is my sample code:
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);
And:
<form id="multiUploadForm" method="post" enctype="multipart/form-data" encoding="multipart/form-data"></form>
<button onclick="javascript:doUpload();">Upload</button>
I have tried adding an input node into the form:
<form id="multiUploadForm" method="post" enctype="multipart/form-data" encoding="multipart/form-data">
<input type="hidden" name="param" value="paramValue"/>
</form>
And I’ve also tried appending the parameter to the url, but no dice:
var uploaderDijit = new dojox.form.Uploader({
id: "uploader",
url: "MyApp/MyServlet?param=paramValue",
multiple: true
});
I believe something else is wrong.. Following is (allthough from 1.7.2 src) the function called which you state is your entrypoint in first code block. with 100% certainty, your GET parameter should be set if you use
url: "MyApp/MyServlet?param=paramValue"
.