Solved

How to upload an image in Java servlets

Posted on 2004-04-07
10
20,419 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

776 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