473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Uploading Image to Directory using Servlet

270 100+
Hello Frendz,
I'm trying to develop Servlet which simply uploads image to particular directory with unique name.

i have wrote following form:
which has two fields filename and the actual file.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head></head>
  3. <body>
  4. <form action="UploadImageServlet" method="POST">
  5. Select Photo: <input type="file" name="txtPhoto" size="20" /><br/>
  6. FileName: <input type="text" name="txtName" size="20" /><br/>
  7. <input type="Submit" value="Submit" />
  8. </form>
  9. </body>
  10. </html>
  11.  
I know the logic but don't know the code to upload selected image to particular directory..

help needed.

regards,
Nitin Sawant
May 31 '09 #1
4 10418
JosAH
11,448 Expert 8TB
This has been done so many times before; does this help? All I did was google for file upload to servlet.

kind regards,

Jos
Jun 1 '09 #2
r035198x
13,262 8TB
A more popular one is Apache's commons-fileupload API.
Also reachable from Google.
Jun 1 '09 #3
NitinSawant
270 100+
Apache's Commons API

I've found links on net:-

http://commons.apache.org/fileupload/using.html

http://www.ietf.org/rfc/rfc1867.txt
Jun 2 '09 #4
NitinSawant
270 100+
I also found sample code

http://www.javaatwork.com/java-uploa...amplecode.html
Jun 2 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: ok | last post by:
Hello, Q: How do I get image width and height before uploading an image? This because, I want to restrict people uploading huge files. Thanks in advance
1
by: jajoo | last post by:
Hi everyone, I am trying to send files with multipart/form-date. Everything is ok with the send. But when I am receiving the files I should specify a directory where the files to be saved. The...
1
by: Vasil Slavov | last post by:
I apologize for the long email. I hope somebody will have time to read it and give some suggestions. I am working on a school project written in Python (using mod_python) and I need to upload a...
1
by: efiedler | last post by:
Hi - I have the following input field on my html page: <input type="image" name="submit" id="submit" src="c:\image.jpg" value="image.jpg"> I also have another input field on the form that is...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
8
by: mpar612 | last post by:
Hello, I am a newbie to PHP, MySQL. I am trying to create a basic file upload form. I want to get that working and then I want to integrate that into a form that will rename the file and save...
8
by: ThunderMusic | last post by:
Hi, I'm currently building a little web site for me and my friends where we would like to be able to post big files (10Mb to 250Mb approx.) Right now the ASP.Net UploadFile control can't do it as...
5
by: thierryParent66 | last post by:
Hi. I am trying to load image from another domain and reading content. How an I get the Image array of bytes after loading it. What I want is to call a server (on another domain as the current...
3
by: jatin299 | last post by:
hi ..problem in uploading image..using servlet to upload image in mysql..use html form so user given the path of image..but giving error.here is the code..help me on this. import java.sql.*;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.