File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Problem with Uploading Pictures using Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with Uploading Pictures using Jsp" Watch "Problem with Uploading Pictures using Jsp" New topic
Author

Problem with Uploading Pictures using Jsp

sravani
Greenhorn

Joined: Dec 06, 2008
Posts: 4
Hi,


My Requirement is to upload the images into database through jsp. For that i write a code .And it works fine .But in that File imgfile = new File("C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/test/Blue.jpg"); instead of that i used File imgfile = new File("Blue.jpg"); like that it didn't work. When we browse that image from local system it automatically takes like Blue.jpg and didn't take the full path.
So i got the error as " Blue.jpg not found". Please tell the solution how can i resolve my problem.


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
Web apps don't have a concept of a "default directory"; you always need to use full, absolute paths. Also, you should not perform I/O in a JSP; JSPs are meant to create HTML or similar texual output, not for any kind of computation. Move that code into a servlet or a backing bean instead. That's much more maintainable.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"sravani",
Please check your private messages regarding an important administrative matter.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Uploading Pictures using Jsp