Solved

File Upload in Java

Posted on 2002-05-21
16
321 Views
Last Modified: 2010-03-31
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 !
0
Comment
Question by:Jitu
  • 5
  • 3
  • 2
  • +3
16 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 7024018
 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.
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 7024033
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
0
 
LVL 92

Expert Comment

by:objects
ID: 7025497
Depends on what your servlet expects.

Can you explain how your servlet is expecting the data?
0
 
LVL 1

Author Comment

by:Jitu
ID: 7026429
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 !!
0
 
LVL 92

Expert Comment

by:objects
ID: 7026447
That's why I asked what format your servlet was expecting the code in? Is it expecting a multipart form post, or something different?
0
 
LVL 1

Author Comment

by:Jitu
ID: 7026611
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 7026620
> 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?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:PFMMaas
ID: 7395991
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...

0
 
LVL 35

Expert Comment

by:girionis
ID: 8766931
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
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 8767627
OK by me. :-)
Jim
0
 
LVL 1

Author Comment

by:Jitu
ID: 8771088
Ok by me :-),
Pls delete this question.
Thanks
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8819829
PAQ'd and points NOT refunded.  I am willing to refund the points on this as soon as I see Jitu has maintained the other 19 open questions that need finalizing.

To see your options for finalizing those questions see: http://www.experts-exchange.com/help/closing.jsp

I will return in a week to check to see that they have been taken care of.  If they have not been taken care of, I have an obligation to turn the account over to the site administrators.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
LVL 1

Author Comment

by:Jitu
ID: 8825124
SpideyMod > I have now completed  the 'maintenance' for the other open questions... Thanks.
0
 
LVL 1

Author Comment

by:Jitu
ID: 8825129
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...
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 62
count8 challlenge 13 87
countHi challenge 25 86
countHi2 challenge 7 44
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now