| Author |
Uploading a Image
|
Anchal Bhargava
Greenhorn
Joined: Jul 22, 2012
Posts: 6
|
|
|
How Can I upload a Image From a jsp page and Store it into Database
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
Welcome to CodeRanch!
There are three parts to your question:
1) How to upload an image - look at the apache commons file upload library
2) Do you want to store the file in the database or on the file system with the database pointing to it.
3) How to store the file/reference in the database - read about JDBC and BLOBs
Note that most of this is done in a servlet or helper class rather than a JSP. JSPs are just for presentation.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56213
|
|
|
Please read the JspFaq prior to posting.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Anchal Bhargava
Greenhorn
Joined: Jul 22, 2012
Posts: 6
|
|
|
Thanks for your reply, I know that jsp is for presentation I mean that I have created a form in jsp and want to upload a image not reference, the actual image in Database
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
It still isn't clear to me what you are asking. Let me post this answer and see if it belongs to your question:
The form in the HTML which your JSP generates should have enctype="multipart/form-data" and method="post". In addition it should contain an <input> element with type="file".
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56213
|
|
|
Did you read the JspFaq?
|
 |
 |
|
|
subject: Uploading a Image
|
|
|