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:
[code=javascript]HTMLElement.Upl oad = function(Params )
{
var FORM = new HTMLElement(HTM LElement.FORM,{
id: 'FO_'+Params.Id ,
action: Params.Handler,
method: 'post',
enctype: 'multipart/form-data',
target: 'FR_'+Params.Id
});
var IFRAME = new HTMLElement(HTM LElement.IFRAME ,{
name: 'FR_'+Params.Id ,
id: 'FR_'+Params.Id ,
width: 0,
height: 0,
border: 0
});
IFRAME.name = 'FR_'+Params.Id ;
IFRAME.style.di splay = 'none';
document.body.a ppendChild(IFRA ME);
if(!Params.MaxF ileSize)
{
Params.MaxFileS ize = 10485760;
}
FORM.appendChil d(new HTMLElement(HTM LElement.INPUT, {
type: 'hidden',
name: 'MAX_FILE_SIZE' ,
value: Params.MaxFileS ize
}));
if(Params.File)
{
FORM.appendChil d(new HTMLElement(HTM LElement.INPUT, {
type: 'file',
name: Params.File,
id: 'FI_'+Params.Id ,
onchange: function()
{
document.getEle mentById('FR_'+ this.id.substri ng(3)).onload = function()
{
if(document.get ElementById('FO _'+this.id.subs tring(3)))
{
document.getEle mentById('FO_'+ this.id.substri ng(3)).innerHTM L = '<i>Done</i>';
}
};
this.parentNode .submit();
var SPAN = new HTMLElement(HTM LElement.SPAN,{ });
SPAN.appendChil d(new HTMLElement(HTM LElement.IMG,{
src: HTMLElement.CON FIG.IMAGE_UPLOA D_LOADER.src,
width: HTMLElement.CON FIG.IMAGE_UPLOA D_LOADER.width,
height: HTMLElement.CON FIG.IMAGE_UPLOA D_LOADER.height
}));
SPAN.appendChil d(new HTMLElement(HTM LElement.SPAN,{
innerHTML: ' Uploadin g file \"'+this.value+ '\"...</i>'
}));
this.parentNode .innerHTML = SPAN.innerHTML;
}
}));
}
else if(Params.Files )
{
for(var i in Params.Files)
{
FORM.appendChil d(new HTMLElement(HTM LElement.INPUT, {
type: 'file',
name: i
}));
}
}
return FORM;
}[/code]
HTMLElement constructor:
[code=javascript]function HTMLElement(aEl ement, Params)
{
if((aElement == HTMLElement.IFR AME ||
aElement == HTMLElement.INP UT) &&
HTMLElement.ISI E)
{
var ParamsString = '';
if(Params.name)
{
ParamsString += ' name="'+Params. name+'"';
}
if(Params.type)
{
ParamsString += ' type="'+Params. type+'"';
}
var aElement = document.create Element('<'+aEl ement+ParamsStr ing+'>');
}
else
{
var aElement = document.create Element(aElemen t);
}
for(var i in Params) aElement[i] = Params[i];
return aElement;
}[/code]
And the code I run is:
[code=javascript]
window.onload = function(){
HTMLElement.onl oad = function()
{
HTMLElement.Con vertSelectsToDr opdowns();
document.getEle mentById('vvv') .appendChild(ne w HTMLElement.Upl oad({
Id: 'upl',
File: 'uploadedfile',
Handler: 'ESCMS_HTMLElem ent/upload.php'
}));
}
new HTMLElement.Inc lude(HTMLElemen t.CLASS_BOX);
new HTMLElement.Inc lude(HTMLElemen t.CLASS_DROPDOW N);
new HTMLElement.Inc lude(HTMLElemen t.CLASS_AJAX);
new HTMLElement.Inc lude(HTMLElemen t.CLASS_UPLOAD) ;
}
[/code]
Thanks in advance
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:
[code=javascript]HTMLElement.Upl oad = function(Params )
{
var FORM = new HTMLElement(HTM LElement.FORM,{
id: 'FO_'+Params.Id ,
action: Params.Handler,
method: 'post',
enctype: 'multipart/form-data',
target: 'FR_'+Params.Id
});
var IFRAME = new HTMLElement(HTM LElement.IFRAME ,{
name: 'FR_'+Params.Id ,
id: 'FR_'+Params.Id ,
width: 0,
height: 0,
border: 0
});
IFRAME.name = 'FR_'+Params.Id ;
IFRAME.style.di splay = 'none';
document.body.a ppendChild(IFRA ME);
if(!Params.MaxF ileSize)
{
Params.MaxFileS ize = 10485760;
}
FORM.appendChil d(new HTMLElement(HTM LElement.INPUT, {
type: 'hidden',
name: 'MAX_FILE_SIZE' ,
value: Params.MaxFileS ize
}));
if(Params.File)
{
FORM.appendChil d(new HTMLElement(HTM LElement.INPUT, {
type: 'file',
name: Params.File,
id: 'FI_'+Params.Id ,
onchange: function()
{
document.getEle mentById('FR_'+ this.id.substri ng(3)).onload = function()
{
if(document.get ElementById('FO _'+this.id.subs tring(3)))
{
document.getEle mentById('FO_'+ this.id.substri ng(3)).innerHTM L = '<i>Done</i>';
}
};
this.parentNode .submit();
var SPAN = new HTMLElement(HTM LElement.SPAN,{ });
SPAN.appendChil d(new HTMLElement(HTM LElement.IMG,{
src: HTMLElement.CON FIG.IMAGE_UPLOA D_LOADER.src,
width: HTMLElement.CON FIG.IMAGE_UPLOA D_LOADER.width,
height: HTMLElement.CON FIG.IMAGE_UPLOA D_LOADER.height
}));
SPAN.appendChil d(new HTMLElement(HTM LElement.SPAN,{
innerHTML: ' Uploadin g file \"'+this.value+ '\"...</i>'
}));
this.parentNode .innerHTML = SPAN.innerHTML;
}
}));
}
else if(Params.Files )
{
for(var i in Params.Files)
{
FORM.appendChil d(new HTMLElement(HTM LElement.INPUT, {
type: 'file',
name: i
}));
}
}
return FORM;
}[/code]
HTMLElement constructor:
[code=javascript]function HTMLElement(aEl ement, Params)
{
if((aElement == HTMLElement.IFR AME ||
aElement == HTMLElement.INP UT) &&
HTMLElement.ISI E)
{
var ParamsString = '';
if(Params.name)
{
ParamsString += ' name="'+Params. name+'"';
}
if(Params.type)
{
ParamsString += ' type="'+Params. type+'"';
}
var aElement = document.create Element('<'+aEl ement+ParamsStr ing+'>');
}
else
{
var aElement = document.create Element(aElemen t);
}
for(var i in Params) aElement[i] = Params[i];
return aElement;
}[/code]
And the code I run is:
[code=javascript]
window.onload = function(){
HTMLElement.onl oad = function()
{
HTMLElement.Con vertSelectsToDr opdowns();
document.getEle mentById('vvv') .appendChild(ne w HTMLElement.Upl oad({
Id: 'upl',
File: 'uploadedfile',
Handler: 'ESCMS_HTMLElem ent/upload.php'
}));
}
new HTMLElement.Inc lude(HTMLElemen t.CLASS_BOX);
new HTMLElement.Inc lude(HTMLElemen t.CLASS_DROPDOW N);
new HTMLElement.Inc lude(HTMLElemen t.CLASS_AJAX);
new HTMLElement.Inc lude(HTMLElemen t.CLASS_UPLOAD) ;
}
[/code]
Thanks in advance
Comment