Solved

load an image

Posted on 2004-04-20
13
176 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 115
Checkbox and ListView in Android Layout 4 65
Should localization be done inside spring controller 5 25
printf performancy 11 33
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

786 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