SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Leeuwarden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ZIP files accessable only from a PHP file

    On our company site we have .zip files containing important information that we only want authorized users to download.

    Is it possible to in some way make it so that certain ZIP files cannot be downloaded unless redirected to from a certain file and given permission?

    Thanks for any help.

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put the zip files outside the documentroot and create a download.php script, for example. Have the download.php script check whatever auth is required then hand them the zip file with something like:
    PHP Code:
    header("Content-Disposition: attachment; filename=$file");
    header("Content-length: " filesize($file));
    header("Content-name: " $file);
    readfile('/path/to/the/zip/file.zip'); 

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Leeuwarden
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If someone knew the address, then they could download without auth?

  4. #4
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it's outside the documentroot you can't get to it directly.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •