uploading an image

Reply

Join Date: Oct 2007
Posts: 26
Reputation: balagangadharm is an unknown quantity at this point 
Solved Threads: 0
balagangadharm balagangadharm is offline Offline
Light Poster

uploading an image

 
0
  #1
Nov 13th, 2007
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
Bala Gangadhar Marripeedi m.balagangadhar@gmail.com
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,358
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: uploading an image

 
0
  #2
Nov 13th, 2007
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.
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,610
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 465
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: uploading an image

 
0
  #3
Nov 13th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: uploading an image

 
0
  #4
Nov 13th, 2007
and learn some English. How do you expect to read documentation if you don't know the language?
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC