2
3

I am planning on having asynchronous file uploads. That is the file should be uploaded to a jsp or servlet and return something to the html/jsp page without reloading the original page. It should happen like an AJAX call. Is there any way to do it in AJAX or any other way to do it.

flag

75% accept rate

3 Answers

0

I don't believe AJAX can handle file uploads but this can be achieved with libraries that leverage flash. Another advantage of the flash implementation is the ability to do multiple files at once (like gmail).

SWFUpload is a good start : http://www.swfupload.org/documentation

jQuery and some of the other libraries have plugins that leverage SWFUpload. On my last project we used SWFUpload and Java without a problem.

Also helpful and worth looking into is Apache's FileUpload : http://commons.apache.org/fileupload/index.html

link|flag
It is indeed possible to do asynchronous file uploads without Flash; e.g. gmail. – DanM Nov 23 '09 at 16:45
If I'm not mistaken, Gmail uses flash as well. – Doomspork Nov 24 '09 at 16:13
2

The two common approaches are to submit the form to an invisible iframe, or to use a Flash control such as YUI Uploader. You could also use Java instead of Flash, but this has a narrower install base.

(Shame about the layout table in the first example)

link|flag
0

The latest dwr (http://directwebremoting.org/dwr/index.html) has ajax file uploads, complete with examples and nice stuff for users (like progress indicators and such).

It looks pretty nifty and dwr is fairly easy to use in general so this will be pretty good as well.

link|flag
anything similar for .net? – daemonkid Aug 14 '09 at 9:46
I don't know - only coded java for webservers so war – laura Aug 14 '09 at 9:55

Your Answer

get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.