Is it possible to not expose my directory where I upload images?
In my website people can upload their photos. And I show them. Is it possible, that they would not be able to see url where that image is?
Photos are shown like this <img src="http://mywebsite.com开发者_JS百科/my_images/image_name.gif" />
. What I want to do, that people couldn't see that src
link. Is there any way to show photos from that directory without exposing directory name?
Thanks.
There isn't, but you can use URL rewriting (apache's mod_rewrite
or a custom PHP script to serve the images) to hide the actual location on your web server.
For example for the latter approach you coud have a serveimage.php
on the server, which is called like serveimage.php?file=file1.jpg
.
You can call another php-script via <img src="...">
the script loads the image and generates it. This FAQ entry should help.
精彩评论