please give code..
image upload
how to upload image in jsp using glassfish server.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ajay PatelPosted Oct 13, 2012, 7:47 AM
String exsistingFileName= "C:\\temp\\myimage.gif";
File file = new File(exsistingFileName);
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = con.prepareStatement("INSERT INTO images VALUES (?, ?)");
ps.setString(1, file.getName());
byte[] b= new byte[fis.available()+1];
fis.read(b);
pst.setBytes(2,b);
int s = ps.executeUpdate();