?
Solved

File Upload in Java

Posted on 2002-05-21
16
Medium Priority
?
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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
 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

801 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