1file upload using iframe<html>
 2file upload using iframe<head>
 3

http://vinayakshrestha.wordpress.com/2007/03/20/javascript-multiple-files-upload-trick/

 1file upload using iframe//creating the iframe
 2file upload using iframe var iframe = document.createElement("iframe");
 3file upload using iframe iframe.setAttribute("id","micox-temp");
 4file upload using iframe iframe.setAttribute("name","micox-temp");
 5file upload using iframe iframe.setAttribute("width","0");
 6file upload using iframe iframe.setAttribute("height","0");
 7file upload using iframe iframe.setAttribute("border","0");
 8file upload using iframe iframe.setAttribute("style","width: 0; height: 0; border: none;");
 9file upload using iframe 
10file upload using iframe //add to document
11file upload using iframe form.parentNode.appendChild(iframe);
12file upload using iframe window.frames['micox-temp'].name="micox-temp"; //ie sucks

http://elmicoxcodes.blogspot.com/2007/03/asynchronous-upload-like-ajax-1.html

Ajax extensions does not support file upload. So, what I have done is create an iframe and put a file upload form inside that iframe. When the upload is complete, the event can then be relayed to the ajax trigger events and do additional tasks in ordinary ajax coding.

This method can also be made GMail like. You can control anything of the iframe using javascript. And hence you can do something like IFrame.forms[0].submit() in javascript to automatically start files uploading (and as it is iframe, it would not look like form post). You can also easily poll the status of the iframe, so that if user clicks other form buttons in your page, you can wait for iframe to complete upload and then finally do other task.

 

相关文章: