I've written a small code in my project where a jsp page takes few parameters like name, cost and image file as parameters as input and stores in the Mysql database.When i'm uploading the file and clicking submit, i get file not found exception.
java.io.FileNotFoundException : 0.jpg (No such file or directory)
I've tried uploading from multiple locations. It didn't change. I have a query:.Why is the images absolute path not being displayed in exception. Is the issue related to this?
This is the piece of code that takes the input.
<form name="f" action="re_pro_insert.jsp" method="post" onsubmit="return valid()">
.
.
.
<tr>
<td align="center"><font color="#333366" size="+1" face="Georgia, Times New Roman, Times, serif"><strong>Product
Image:</strong></font>
</td>
<td align="center">
<input type="file" name="proimage" size="8" id="b" vlaue="jj">
</td>
</tr>
This is the part where the file is read to be stored. this is throwing the exception
FileInputStream fis=null;
String a = request.getParameter("comname");
String b = request.getParameter("proname");
String c = request.getParameter("wardate");
String d = request.getParameter("proimage");
String e = request.getParameter("prorate");
String f="";
String g=f+d;
File image=new File(g);
fis=new FileInputStream(image);
Any idea?
I'm running this on Apache Tomcat 7 through eclipse.
Thank you.