0

The files are going to be stored in a folder next to httpdocs. Thus, it will make hard to display 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
ilhan
  • 8,700
  • 35
  • 117
  • 201

2 Answers2

1

Configure your web server to graft that directory into your URL space, e.g. using Alias with HTTPd.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • Thanks. And, it seems that PHP does not obey to those rules. Is there any way to make PHP listen to Alias? – ilhan Jul 22 '11 at 12:08
  • PHP doesn't care about your web server configuration beyond what PHP needs. If you want to use the URL space covered by an `Alias` directive in PHP then it is up to you to use it appropriately. – Ignacio Vazquez-Abrams Jul 22 '11 at 20:04
1

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);

?>
marc
  • 6,103
  • 1
  • 28
  • 33