Link to home
Start Free TrialLog in
Avatar of Jitu
Jitu

asked on

File Upload in Java

I need java code for uploading files to a URL (Servlet).
i.e the code i would write in a java application to connect to a URL and upload my file.

Any sample code would be of great help !
Avatar of girionis
girionis
Flag of Greece image

 There are a number of libraries that do it. Take a look at the jGuru page: http://www.jguru.com/faq/view.jsp?EID=160 it contains useful dicussions and links.

  Hope it helps.
I think you can use the the com.oreilly.servlet package available here:
    http://www.servlets.com/cos/index.html

The javadoc refers to Applet->Servlet communications but I don't see why it couldn't be used for Application->Servlet communications over HTTP.

There is also the HTTPClient package available here:
    http://www.innovation.ch/java/HTTPClient/

Best regards,
Jim Cakalic
Depends on what your servlet expects.

Can you explain how your servlet is expecting the data?
Avatar of Jitu
Jitu

ASKER

Most of the links posted here point to how to receive the file by a servlet. This is not what i want.

I am looking for Java CLIENT side (application) code that would do a form submit to a URL with a FILE. It would mimic the form submission and send a File.

This link too - http://www.innovation.ch/java/HTTPClient/
does not have the client side File Upload code. It has code for connecting to a URL etc..

I would appreciate if someone can COPY the code here.

Thanks for your Help !!
That's why I asked what format your servlet was expecting the code in? Is it expecting a multipart form post, or something different?
Avatar of Jitu

ASKER

I have no idea what format the servlet in question is expecting the form post to be, since i only have the URL to the servlet and no other info. in other words - i am not the owner of the servlet and dont have documentation to it at present.

So can u assume the possible formats and tell me what the code would look like.
thanks.
> So can u assume the possible formats

The possibilities are infinite.
You'll need to find what it expects to be able to communicate with it.
What currently posts to it?
Hmmm.... has anybody actually solved this problem? I'm trying to do the same thing, although I'm writing the servlet myself...

what I would like to do is have an application send a mp3 file to a servlet. Currently I have a working formbase file-upload...

No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- To be deleted and points refunded

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
OK by me. :-)
Jim
Avatar of Jitu

ASKER

Ok by me :-),
Pls delete this question.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jitu

ASKER

SpideyMod > I have now completed  the 'maintenance' for the other open questions... Thanks.
Avatar of Jitu

ASKER

Is there a way to just see only your 'open' questions, rather seeing all of them....since in this case we have to keep going from one page to another to see the whole list...