 | Member | | Join Date: Jul 2009 Location: Israel
Posts: 85
| |
Hi all,
anyone has an idea why IE is not uploading file and FF does? I'm creating a FORM + IFRAME using DOM and trying to upload a file, now Firefox and Chrome do thins perfectly.
I have attached a Log from HTTPAnalyzer.
Anyhow, here's the code I'm running, Class File: - HTMLElement.Upload = function(Params)
-
{
-
var FORM = new HTMLElement(HTMLElement.FORM,{
-
id: 'FO_'+Params.Id,
-
action: Params.Handler,
-
method: 'post',
-
enctype: 'multipart/form-data',
-
target: 'FR_'+Params.Id
-
});
-
var IFRAME = new HTMLElement(HTMLElement.IFRAME,{
-
name: 'FR_'+Params.Id,
-
id: 'FR_'+Params.Id,
-
width: 0,
-
height: 0,
-
border: 0
-
});
-
IFRAME.name = 'FR_'+Params.Id;
-
IFRAME.style.display = 'none';
-
document.body.appendChild(IFRAME);
-
-
if(!Params.MaxFileSize)
-
{
-
Params.MaxFileSize = 10485760;
-
}
-
-
FORM.appendChild(new HTMLElement(HTMLElement.INPUT,{
-
type: 'hidden',
-
name: 'MAX_FILE_SIZE',
-
value: Params.MaxFileSize
-
}));
-
-
if(Params.File)
-
{
-
FORM.appendChild(new HTMLElement(HTMLElement.INPUT,{
-
type: 'file',
-
name: Params.File,
-
id: 'FI_'+Params.Id,
-
onchange: function()
-
{
-
document.getElementById('FR_'+this.id.substring(3)).onload = function()
-
{
-
if(document.getElementById('FO_'+this.id.substring(3)))
-
{
-
document.getElementById('FO_'+this.id.substring(3)).innerHTML = '<i>Done</i>';
-
}
-
};
-
this.parentNode.submit();
-
-
var SPAN = new HTMLElement(HTMLElement.SPAN,{});
-
SPAN.appendChild(new HTMLElement(HTMLElement.IMG,{
-
src: HTMLElement.CONFIG.IMAGE_UPLOAD_LOADER.src,
-
width: HTMLElement.CONFIG.IMAGE_UPLOAD_LOADER.width,
-
height: HTMLElement.CONFIG.IMAGE_UPLOAD_LOADER.height
-
}));
-
SPAN.appendChild(new HTMLElement(HTMLElement.SPAN,{
-
innerHTML: ' Uploading file \"'+this.value+'\"...</i>'
-
}));
-
this.parentNode.innerHTML = SPAN.innerHTML;
-
}
-
}));
-
}
-
else if(Params.Files)
-
{
-
for(var i in Params.Files)
-
{
-
FORM.appendChild(new HTMLElement(HTMLElement.INPUT,{
-
type: 'file',
-
name: i
-
}));
-
}
-
}
-
return FORM;
-
}
HTMLElement constructor: - function HTMLElement(aElement, Params)
-
{
-
if((aElement == HTMLElement.IFRAME ||
-
aElement == HTMLElement.INPUT) &&
-
HTMLElement.ISIE)
-
{
-
var ParamsString = '';
-
if(Params.name)
-
{
-
ParamsString += ' name="'+Params.name+'"';
-
}
-
if(Params.type)
-
{
-
ParamsString += ' type="'+Params.type+'"';
-
}
-
var aElement = document.createElement('<'+aElement+ParamsString+'>');
-
}
-
else
-
{
-
var aElement = document.createElement(aElement);
-
}
-
for(var i in Params) aElement[i] = Params[i];
-
return aElement;
-
}
And the code I run is: -
window.onload = function(){
-
HTMLElement.onload = function()
-
{
-
HTMLElement.ConvertSelectsToDropdowns();
-
document.getElementById('vvv').appendChild(new HTMLElement.Upload({
-
Id: 'upl',
-
File: 'uploadedfile',
-
Handler: 'ESCMS_HTMLElement/upload.php'
-
}));
-
}
-
new HTMLElement.Include(HTMLElement.CLASS_BOX);
-
new HTMLElement.Include(HTMLElement.CLASS_DROPDOWN);
-
new HTMLElement.Include(HTMLElement.CLASS_AJAX);
-
new HTMLElement.Include(HTMLElement.CLASS_UPLOAD);
-
-
}
-
Thanks in advance
|