Solved

load an image

Posted on 2004-04-20
13
181 Views
Last Modified: 2010-03-31

Hello, my web app allows users to but items, I have this working fine but i want to add an administration side that allows users to add new items to the database. Each item contains contains an image. What code do I need to load an image in java/jsp? Can an image be saved in a mysql database?
0
Comment
Question by:wallpaperpaste
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +1
13 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10868899
You mean you want them to be able to upload an image file?
0
 

Author Comment

by:wallpaperpaste
ID: 10872478

Yes exactly
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10872566
You need to have an upload form containing a

<input type="file"

etc.

then use a class such as Jakarta commons FileUpload on the jsp side and then write it to mysql
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 92

Expert Comment

by:objects
ID: 10873936
heres an example showing u how to insert image into database:
http://www.javaalmanac.com/egs/java.sql/InsertBinary.html
0
 
LVL 92

Accepted Solution

by:
objects earned 25 total points
ID: 10873966
your html would contain:

<form name="myform" action="upload.jsp" method="post" enctype="multipart/form-data">
  Image: <input type="file" name="myimage">
...

your jsp would contain:

DiskFileUpload upload = new DiskFileUpload();
List items = upload.parseRequest(request);
Iterator i = items.iterator();
while(i.hasNext())
{
    FileItem item = (FileItem) i.next();
    ...
}
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 25 total points
ID: 10878698
>> http://www.javaalmanac.com/egs/java.sql/InsertBinary.html

That one has had lot of discussion on: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20926879.html

;-)

Maybe you would like to read that to consider them....
0
 

Author Comment

by:wallpaperpaste
ID: 10923518

Hello people, i havent been on in a while, just trying your methods now
0
 

Author Comment

by:wallpaperpaste
ID: 10923900

Could you post some more sample code, im not making any real progress
0
 
LVL 92

Expert Comment

by:objects
ID: 10924572
i did above, you just need to take the FileItem and extract its contents.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10925441
Maybe you could post your own code as of now and we could try to shape it up a little.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 11678133
Sounds ok.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

728 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