Solved

How to upload an image in Java servlets

Posted on 2004-04-07
10
20,425 Views
Last Modified: 2013-11-24
Hi,
I am new to Java Servlets programming.I am using Windows platform,Oracle HTTP Server(Servlet enabled).Can u please give me code to how to upload the images from a web Form to a server directory.I am trying to write the code using Servlets.
Thanks
Aayushdeep Garg
Web:
http://profile.iiita.ac.in/adgarg_02
0
Comment
Question by:aayush123
  • 5
  • 2
10 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 10781435
I don't think that I understand your question properly. Does this help you?:

http://otn.oracle.com/sample_code/tech/java/servlets/htdocs/vsmfilters/fileupload.html
0
 

Author Comment

by:aayush123
ID: 10781473
I want the code thst will be on the server for uploading an image from my web form to the server.The code will be written in servlets for file uploading on the sever.It willbe executed on the server on pressing the submit button.
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 30 total points
ID: 10781685
Did the link that I posted, help? If not, try the code at this page:

http://forums.devshed.com/archive/t-122423
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 30

Expert Comment

by:Mayank S
ID: 10781688
Add a doPost () method to it as well.
0
 

Author Comment

by:aayush123
ID: 10784835
Hi,
The code given at:
http://otn.oracle.com/sample_code/tech/java/servlets/htdocs/vsmfilters/fileupload.html
 
is not useful to me.
but I like something given at
http://forums.devshed.com/archive/t-122423
but it is not running and not understandable also.Please give another example.
Thanks.
Aayushdeep Garg
Web:
http://profile.iiita.ac.in/adgarg_02
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10789417
What error is it giving? Any specific compilation errors/ runtime exceptions? If so, please post the code along with the error messages and tell at which line you are getting the error.
0
 
LVL 3

Assisted Solution

by:mjzalewski
mjzalewski earned 30 total points
ID: 10805763
For a good snap-in component (open source), you might want to try

Apache Jakarta Commons FileUpload Component
http://jakarta.apache.org/commons/fileupload

I like this one because you can upload to memory or disk, multiple files at a time, and there is a forum where you can ask questions.

0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10978153
Please proceed with that recommendation.
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 56
Why my table column Id is not passed to java object? 4 44
How can i point a subdomain to directory? 5 30
ejb mdb examples 1 6
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

809 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