Displaying files from out of httpdocs location
The files are going to be stored in a folder next to httpdocs. Thus, it will make hard to dis开发者_开发技巧play those files to internet user. How I'll overcome this problem? I mean, I want to display/serve those files to the users. Probably I need to use some kind of proxy file?
Old one:
-httpdocs\
-index.php
-uploads\ <-
-folder\
-image.png
-image3.jpg
-folderbla\
-personal.jpg
-sp.pdf
New one:
-httpdocs\
-index.php
-uploads\ <----
-folder\
-image.png
-image3.jpg
-folderbla\
-personal.jpg
-sp.pdf
Configure your web server to graft that directory into your URL space, e.g. using Alias
with HTTPd.
You can use a PHP script and file_get_contents
, e.g.
<?php
$file_name = $_GET['file'] or die();
// sanitize, validate the string
// check user permission
file_get_contents($file_name);
?>
精彩评论