| | |
uploading an image
![]() |
•
•
Join Date: Oct 2007
Posts: 26
Reputation:
Solved Threads: 0
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
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
Bala Gangadhar Marripeedi m.balagangadhar@gmail.com
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.
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.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Look into the Apache File Upload module to ease the task of file uploads.
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- Uploading an image into a Jpanel (Java)
- mpeg uploading (Ruby)
- Uploading Image in freetext box dll (ASP.NET)
- check for images duplication (ASP.NET)
- thumbnail from pdf file (ASP)
- uploading image in database (PHP)
Other Threads in the Java Forum
- Previous Thread: Game algorithm help
- Next Thread: Help(polymorphic variables in java)
| Thread Tools | Search this Thread |
-xlint actionlistener android api applet application array arrays automation bi binary blackberry block bluetooth character chat class client code compile compiler component consumer database desktop developmenthelp eclipse error fractal freeze ftp game gameprogramming givemetehcodez graphics gui html ide image integer j2me j2seprojects java javac javaee javaprojects jetbrains jni jpanel jtable julia learningresources lego linked linux list loops mac map method methods mobile netbeans newbie notdisplaying number online printf problem program programming project properties qt recursion researchinmotion rotatetext rsa scanner screen server set singleton sms sort sql string swing system textfields threads time title tree tutorial-sample update variablebinding windows working xor






