Win a copy of Penetration Testing Basics this week in the Security forum!
    Bookmark Topic Watch Topic
  • New Topic

jsp/Mysql uploading an image?

Nour-eddine Ghtami
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
i tried to upload a picture and pass it from (upload_pic.jsp) to (show_pic.jsp)pages in order to store it in a Mysql table as a BLOB type, but i run into an Exception of 1 error in(show_pic.jsp)page as the following :

incompatible types
found : java.lang.String
required: java.sql.Blob
Blob img=request.getParameter("pic_");

this is part of (upload_pic.jsp)
<form method="post" action='<%= response.encodeURL("show_pic.jsp") %>'>
<input type="file" name="pic_" /><br>
<input type=submit value=upload ></form>

and this is part of (show_pic.jsp)
<% Class.forName("");
Connection cnct = DriverManager.getConnection("jdbc:mysql:///propertysearch");
Statement stmt=cnct.createStatement();
Blob img=request.getParameter("pic_");

String upld="insert into binar_d values(null,'"+img+"','');";
String display="select * from binar_d ";
ResultSet RS =stmt.executeQuery(display);
{ Blob pic=RS.getBlob("pic_ures");
out.write("<div align=center>"+ pic +"</div>");

anyone to show me where the problem resides please?

thank you.
Bear Bibeault
Author and ninkuma
Posts: 65273
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

Conduct any discussion of this topic here.
[ June 02, 2004: Message edited by: Bear Bibeault ]
    Bookmark Topic Watch Topic
  • New Topic