我正在使用 FileInput 和 iframe 发送多部分请求
var _newForm;
if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
// just to reiterate, IE is a steaming pile of code.
_newForm = document.createElement('<form enctype="multipart/form-data" method="post">');
_newForm.encoding = "multipart/form-data";
}else{
// this is how all other sane browsers do it
_newForm = document.createElement('form');
_newForm.setAttribute("enctype","multipart/form-data");
}
_newForm.appendChild(foo.fileInput);
console.log("FP is "+foo.fileInput);
dojo.body().appendChild(_newForm);
var o = dojo.io.iframe.send({
url: foo.url,
form: _newForm,
load: uploadComplete,
error: onBeforeSend
});
我面临的问题是,我只能发送一个成功的请求。其次,我需要刷新页面。请告诉我,发送多个文件需要做什么。