Solved

How to upload an image in Java servlets

Posted on 2004-04-07
10
20,402 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:mayankeagle
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:
mayankeagle 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
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10781688
Add a doPost () method to it as well.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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:mayankeagle
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:mayankeagle
ID: 10978153
Please proceed with that recommendation.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

759 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

21 Experts available now in Live!

Get 1:1 Help Now