I'm trying to realize system for submitting files without full page rerendering. In order to do this I've created a form with input (type = file
) in it and a mechanism for dynamic iframe creating/appending. After the iFrame is created and appended, I set target
attribute of the form on the iframe.
In other browsers this mechanism works perfectly, but IE instead of loading content into the iFrame propose me to save input data like a file. What is incorrectly in my logic? Perhaps this is a problem of dynamic creation of iFrame or something wrong with configuration of my IE?
Here is the sources:
createIFrame: function(appendToSelector) {
var nameWthId = "uploadTarget" + (new Date().getTime());
var iFrame = $("<iframe style='display:none;'></iframe>");
iFrame.attr('id', nameWthId);
iFrame.attr('name', nameWthId);
iFrame.appendTo(appendToSelector);
return nameWthId;
}
fileUploadManual: function(dom) {
var iFrameName = context.createIFrame(dom + " .manual-upload-file");
$(dom + " .fileUploadForm")[0].target = iFrameName;
$(dom + " .fileUploadForm")[0].action = config.post;
$(dom + " #" + iFrameName).load(function(ev) {
//some logic
})
}