Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

upload image on server using jsp

Status
Not open for further replies.

lovinasd

Programmer
Jan 23, 2005
23
US
hi,
I have tried upload a a image from jsp to a servlet at the server side using the html file type and image class in java.but the speed is quiet slow.
CAn any one tell me how can i upload a file or image from client to server side i mean in terms of a image not a path so that the entire image can be stored in the database as blob.
I have tired dsaving using relative url and the speed is too slow.
CAn any one help
thanks
 
I am no expert;
you can write a code in your jsp to convert the image to a byte array and send it to the servlet for storage in the database as a blob(binary stream)

File file=new File(imagefile);
int len=(int)file.length();
byte[] buf=new byte[len];
FileInputStream fis=new FileInputStream(file);
fis.read(buf);

return buf;

I hope this is not too elementary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top