User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 455,962 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,578 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 774 | Replies: 3
Reply
Join Date: Oct 2007
Posts: 25
Reputation: balagangadharm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
balagangadharm balagangadharm is offline Offline
Light Poster

uploading an image

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,508
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: uploading an image

  #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  
Join Date: Jun 2006
Location: India
Posts: 7,009
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: uploading an image

  #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.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 19
Solved Threads: 200
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: uploading an image

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 8:58 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC