views:

132

answers:

2

I don't want to use flash. I've found multiple jquery libraries that do this. Right now I'm using this one: http://demo.webdeveloperplus.com/ajax-file-upload/

The problem is they all use PHP. I tried just pointing it at my servlet instead of the PHP file, but it never gets called.

A: 

Try plupload. Back end should not matter.

Adam
Doesn't seem like backend should matter in any of these solutions, but it does.
Joren
@Joren Are you using Servlets? You can use MultipartRequest at http://www.servlets.com/cos/ to get the data if you set plupload to use multipart requests.
Adam
I created an example Java Servlet backend for Plupload. You can get it here:http://blog.shadit.com/2010/10/28/java-servlet-plupload/
shadit
+1  A: 

I did it with this jquery plugin. It pretty much mimics standard jquery ajax functionality, but also allows you to send data using iframe. No flash involved, pure javascript.

http://malsup.com/jquery/form/

Here is a file upload example
http://malsup.com/jquery/form/#file-upload

Nikita Rybak
I tried 3 different ajax libraries similar to the above, and they all submit to PHP files. I couldn't get any of them to submit to a servlet.
Joren
Then you should forget ajax for a minute and setup your servlet to handle file input sent by plain form. When your servlet is working, it doesn't matter whether request is ajax or not. And yes, I did use that plug-in with servlet (spring MVC).
Nikita Rybak
Ok I got it working. This particular jquery plugin apparently works with a servlet path while all the other ones I tried only worked with .php files. Just my luck that I had to try all the ones that didn't work first.
Joren