hi,
Iam using tomca,mysql.In my appl ,i wrote a code to upload an image using jps.its working fine in my system.But wen i access my appl from another system(in LAN),iam unable to upload the image.p[lz tell me wats wrong in my code

PreparedStatement st=con.prepareStatement("update login set photo=? where uid=?");
File f=new File(request.getParameter("photo"));
InputStream fis=new FileInputStream(f);
st.setBinaryStream(1,fis,(int)f.length());
st.setString(2,request.getParameter("t1"));
st.setString(2,session.getAttribute("uid").toString());
st.executeUpdate();

the error showing is
///

HTTP Status 404 - D:\Documents and Settings\Administrator.TARKA-9\Desktop\New Folder\images\top_links_left_corner.jpg (The system cannot find the path specified)

--------------------------------------------------------------------------------

type Status report

message D:\Documents and Settings\Administrator.TARKA-9\Desktop\New Folder\images\top_links_left_corner.jpg (The system cannot find the path specified)

description The requested resource (D:\Documents and Settings\Administrator.TARKA-9\Desktop\New Folder\images\top_links_left_corner.jpg (The system cannot find the path specified)) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.4

///
plz help thank u in advance

It has nothing to do with the JDBC code (excpet for where it opens the file), and everything to do with how you are retreiving the file. Seemingly, according to the error messages, you are not uploading a file into the db, but simply saving a local file into the db.

You should not be attempting to open a file. The file upload request contains the file, you should be using the inputstream from the request, n ot attempting to open a file.

This article has been dead for over six months. Start a new discussion instead.