473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

IE Upload file problem

Canabeez
126 100+
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:
Expand|Select|Wrap|Line Numbers
  1. HTMLElement.Upload = function(Params)
  2. {
  3.     var FORM = new HTMLElement(HTMLElement.FORM,{
  4.         id:      'FO_'+Params.Id,
  5.         action:  Params.Handler,
  6.         method:  'post',
  7.         enctype: 'multipart/form-data',
  8.         target:  'FR_'+Params.Id
  9.     });
  10.     var IFRAME = new HTMLElement(HTMLElement.IFRAME,{
  11.         name:    'FR_'+Params.Id,
  12.         id:      'FR_'+Params.Id,
  13.         width:   0,
  14.         height:  0,
  15.         border:  0
  16.     });
  17.     IFRAME.name = 'FR_'+Params.Id;
  18.     IFRAME.style.display = 'none';
  19.     document.body.appendChild(IFRAME);
  20.  
  21.     if(!Params.MaxFileSize)
  22.     {
  23.         Params.MaxFileSize = 10485760;
  24.     }
  25.  
  26.     FORM.appendChild(new HTMLElement(HTMLElement.INPUT,{
  27.         type:  'hidden',
  28.         name:  'MAX_FILE_SIZE',
  29.         value: Params.MaxFileSize
  30.     }));
  31.  
  32.     if(Params.File)
  33.     {
  34.         FORM.appendChild(new HTMLElement(HTMLElement.INPUT,{
  35.             type: 'file',
  36.             name: Params.File,
  37.             id:   'FI_'+Params.Id,
  38.             onchange: function()
  39.             {
  40.                 document.getElementById('FR_'+this.id.substring(3)).onload = function()
  41.                 {
  42.                     if(document.getElementById('FO_'+this.id.substring(3)))
  43.                     {
  44.                         document.getElementById('FO_'+this.id.substring(3)).innerHTML = '<i>Done</i>';
  45.                     }
  46.                 };
  47.                 this.parentNode.submit();
  48.  
  49.                 var SPAN = new HTMLElement(HTMLElement.SPAN,{});
  50.                 SPAN.appendChild(new HTMLElement(HTMLElement.IMG,{
  51.                     src: HTMLElement.CONFIG.IMAGE_UPLOAD_LOADER.src,
  52.                     width: HTMLElement.CONFIG.IMAGE_UPLOAD_LOADER.width,
  53.                     height: HTMLElement.CONFIG.IMAGE_UPLOAD_LOADER.height
  54.                 }));
  55.                 SPAN.appendChild(new HTMLElement(HTMLElement.SPAN,{
  56.                     innerHTML: '&nbsp;Uploading file \"'+this.value+'\"...</i>'
  57.                 }));
  58.                 this.parentNode.innerHTML = SPAN.innerHTML;
  59.             }
  60.         }));
  61.     }
  62.     else if(Params.Files)
  63.     {
  64.         for(var i in Params.Files)
  65.         {
  66.             FORM.appendChild(new HTMLElement(HTMLElement.INPUT,{
  67.                 type: 'file',
  68.                 name: i
  69.             }));
  70.         }
  71.     }
  72.     return FORM;
  73. }
HTMLElement constructor:
Expand|Select|Wrap|Line Numbers
  1. function HTMLElement(aElement, Params)
  2. {
  3.     if((aElement == HTMLElement.IFRAME ||
  4.         aElement == HTMLElement.INPUT) &&
  5.             HTMLElement.ISIE)
  6.     {
  7.         var ParamsString = '';
  8.         if(Params.name)
  9.         {
  10.             ParamsString += ' name="'+Params.name+'"';
  11.         }
  12.         if(Params.type)
  13.         {
  14.             ParamsString += ' type="'+Params.type+'"';
  15.         }
  16.         var aElement = document.createElement('<'+aElement+ParamsString+'>');
  17.     }
  18.     else
  19.     {
  20.         var aElement = document.createElement(aElement);
  21.     }
  22.     for(var i in Params) aElement[i] = Params[i];
  23.     return aElement;
  24. }
And the code I run is:
Expand|Select|Wrap|Line Numbers
  1. window.onload = function(){
  2.     HTMLElement.onload = function()
  3.     {
  4.         HTMLElement.ConvertSelectsToDropdowns();
  5.         document.getElementById('vvv').appendChild(new HTMLElement.Upload({
  6.             Id: 'upl',
  7.             File: 'uploadedfile',
  8.             Handler: 'ESCMS_HTMLElement/upload.php'
  9.         }));
  10.     }
  11.     new HTMLElement.Include(HTMLElement.CLASS_BOX);
  12.     new HTMLElement.Include(HTMLElement.CLASS_DROPDOWN);
  13.     new HTMLElement.Include(HTMLElement.CLASS_AJAX);
  14.     new HTMLElement.Include(HTMLElement.CLASS_UPLOAD);
  15.  
  16. }
  17.  
Thanks in advance
Attached Files
File Type: zip Log.zip (1.56 MB, 129 views)
Jul 27 '09 #1
1 4377
acoder
16,027 Expert Mod 8TB
I've not tested your code, but do you get any errors?

Here's one that should work.
Sep 5 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Muppy | last post by:
I've created a page with a form to upload files: <h1>Upload di un file</h1> <form enctype="multipart/form-data" method="post" action="do_upload1.php"> <p><strong>File da trasferire:</strong><br>...
1
by: Selena | last post by:
I have vb.net windows application which need to upload file to server. It can run properly without using VPN. How can I run it with VPN? Is there any components or code to upload file? Or is there...
0
by: new to add-in | last post by:
In asp.net/c#, it's easy to implement Upload file to web server, just use Request.Files or Request.InputStream & runat=server form and type=file input controls. But now, it's a problem for me how...
4
by: bienwell | last post by:
Hi all, I developed an web page in ASP.NET to upload file into the server. In the Web.config file, I declared <httpRuntime executionTimeout="1200" maxRequestLength="400000" /> The MAX...
0
by: wasif | last post by:
I am trying to upload file using ajax and php but having some problems. it always says that there was a problem and file is not uploaded. here is the code form and ajax code <!DOCTYPE html...
2
by: suresh_nsnguys | last post by:
Hi, I am working in digital signage application where user can upload image,flash and movie files .and later thay can view the uploaded files in digital LCD screen. I am facing 1...
4
by: google.com | last post by:
Hi there! I've been digging around looking for a sample on how to upload a file without user action. I found the following article covering the area: ...
6
by: | last post by:
Hi, I use upload control, how to enable upload *.pdf file and enlarge file size? Please help.
5
by: BigZero | last post by:
Hello, i m using apache server and php 5.2.2-3 i need to upload fle well that part i did, the problem is i can upload a file of limit that is less then 2mb i can't upload file that as more then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.