Jump to content


uploading files with ajax

  • Please log in to reply
2 replies to this topic

#1 cfemocha

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 26 October 2006 - 06:21 AM

Im trying to use an iframe to upload files. Im copying every input fields from a real form to a form inside a hidden iframe, all fields worked fine except the files that is to be uploaded.

Below is part of my code

for (var i=0 ; i < oForm.elements.length; i++) 
{ var oHidden = oIFrame.document.createElement("input"); 
    oHidden.type = "hidden"; 
    oHidden.name = oForm.elements[i].name; 
    oHidden.value = oForm.elements[i].value; 
oHiddenForm.encoding = "multipart/form-data";  
oHiddenForm.action = oForm.action; 

Ive tried everything i could and still couldnt get it to work. Please help.

#2 ober

  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 27 October 2006 - 07:53 PM

This is not AJAX functionality!?

Info: PHP Manual

#3 AlexaW

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 28 October 2006 - 06:20 AM

Take a look at this tutorial:

It shows how to organize the File Upload and show the progress meter in Ajax manner.
This is an online demo for this tutorial:

Yep, the demo uses Iframe also. Uploading file using the true Ajax technology is limited by the browser security. Actually, this is a way to go, but work only with FireFox:

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users