Solved

File Upload in Java

Posted on 2002-05-21
16
323 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
expectj telnet failing 5 45
jboss wildfly 10.1 10 228
Selenium docs api java index 3 48
What browser will run Java? 7 55
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

839 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