On Jun 28, 12:12 am, dreamznatcher <tashfeenmah... @gmail.comwrote :
Hello,
I found a script here:http://www.webtoolkit.info/ajax-file-upload.html
which supposedly allows you to upload files using AJAX (I'm not an
expert). The site claims it's the best way to upload files out there,
and the file size is only 1 kb.
I couldn't get it to work for me. I downloaded the files to my
computer, and opened the index file with my browser. It doesn't work
(the demo on their site does); IE doesn't show any error messages or
anything, and FF shows a single word that might be treated as an error
notifier: 'undefined'. Does this thing even work? If it does, could
anyone please give me detailed steps on how to using it on my site?
dzn
it just posts to a hidden iframe. and grabs the body reponse from the
script in the iframe, returning it to the parent frame as "what file
you just sent me"
this is easy to do with no javascript
<form action="post" target="iframe" action="upload_ script.php"
enctype="multip art/form-data"
>
<input name="file" type="file" />
<input name="submit" type="submit" value="doit" />
</form>
<iframe src="" name="iframe"></iframe>
now create upload_script.p hp
<?php print_r( $_FILES ); ?>
and press submit, you will see the details of the file uploaded. It
would be upl to you to stick more logic in the upload_scipr.ph p but
you get the basic idea, all this site does it have javascript inject
the iframe and a bit other stuff, "unobtrusiv ely"
Now you /ca/ upload using pure XHR, but it requires you to set some
custom (and insecure) security settings for firefox, and wont work on
IE, so for now, stick to hidden iframes.
There is a problem with receiving real times messages back from an
uploading file in the iframe, so you might think - oooo - I can have
message coming back to me from that iframe telling me how far along
its got, and so on... Once you actually start uploading properly
instead of reporting what the upload /would/ have been - things et
trickier and although there are some "real time reporting" iframe
upload scripts around they tend to be a bit hit and miss, making
assumptions about temporary files and so on, and lacking multiple
uploaders support.