File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Blocking access to images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Blocking access to images" Watch "Blocking access to images" New topic
Author

Blocking access to images

Hemant Visal
Greenhorn

Joined: Dec 19, 2003
Posts: 8
Hello,
I have a application where users upload images to the server. I am using Tomcat 4.1.27. The folder structure is as below :
webapp
|__application
|__images
|___data
|___temp
Images uploaded by user are temporarily stored under webapps/application/images/temp folder. After processing the image, its preview is displayed to the user and once he submits the page, the image is copied with a different name to the data folder.
When the image preview is displayed, it is displayed using line
<IMG src="/application/images/temp/tempimagename.jpg" >
Now my problem is, I don't want the user to access any file under temp or data folder. If the user types such a url in the browser, he shouldn't be allowed to view the file.
http://url ort/application/images/temp/tempimagename.jpg or
http://url ort/application/images/data/imagename.jpg
At the same time, I have a functionality for the admin, where he will be displayed with the image as
<IMG src="/application/images/data/imagename.jpg" >
Is it possible to restrict the user? How can I block any direct access to the file.
Please help me ASAP.
Thanks in advance
Hemant.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
See my answer in one of the other forums (servlet or JSP). Posting the same question to multiple forums is considered impolite - especially when your question is not Tomcat specific.
Bill
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Check out the answers in the Servlets discussion.
http://www.coderanch.com/t/357592/Servlets/java/blocking-access-images
 
 
subject: Blocking access to images
 
Similar Threads
JSP and deployment
blocking access to images
get the absolute url from JSP or servlet
Deployment issue
blocking access to images