aspose file tools
The moose likes JDBC and the fly likes Save Image into Mysql database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Save Image into Mysql database" Watch "Save Image into Mysql database" New topic
Author

Save Image into Mysql database

Dev Anand
Ranch Hand

Joined: Aug 30, 2009
Posts: 40

I'm using the following code to insert image into Mysql database. It works fine in Internet Explorer. But it is not working in the remaining browsers like Mozilla n Opera, throwing file name not found exception.

How to solve this problem to work fine in all the browsers?
------------code---------------

imgUrl=request.getParameter("file_image")!=null ? request.getParameter("file_image"):"";
FileInputStream in =null;
int len=0;
try
{
in= new FileInputStream(imgUrl);
len=in.available();
}
catch(Exception e)
{
System.out.println(e);
}
pstmt.setBinaryStream(4, fis, len);

----------------------------code End--------------------------
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 391
It seems to be a problem with the jsp, can you post some code here please ?


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Save Image into Mysql database
 
Similar Threads
Loading an Image
Display Image in JSP retrieved from database by servlet
Servlet Download Problem
Displaying an image from byte[] into JSP
how to store an image into the DataBase using oracle database