List Info

Thread: how can i hide the path of file so user can not download it directly




how can i hide the path of file so user can not download it directly
user name
2006-06-29 08:27:45
Hi.
You can do it a different way:
1. create folder for this files.
2. create in this folder file named ".htaccess"
with text:
AuthType Basic
AuthName "No access"
AuthUserFile .htnopasswd
AuthGroupFile /dev/null
Require valid-user

and nobody will upload file directly.
3. create php file (in upper folder), similar to
  header("Expires: Mon, 26 Nov 1962 00:00:00
GMT");
  header("Last-Modified: " . gmdate("D,d M
Y H:i:s") . " GMT");
  header("Cache-Control: no-cache,
must-revalidate");
  header("Pragma: no-cache");
  header("Content-Type:
Application/octet-stream");
  header("Content-disposition: attachment;
filename=" . $filename);
// This will work on all systems, but will need considerable
resources
// We could also loop with fread($fp, 4096) to save memory
    readfile($full_path_from_root_folder . $filename);

It's a very simple way to do it. You can do it by creation
temp dir,
make simlink here to downloadible file and make here
redirection. Or
try another way.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )