note 33866 added to function.readfile
| From: | trouby at hotmail dot com | Date: | Wed, 09 Jul 2003 17:24:18 +0000 |
| Subject: | note 33866 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51800@lists.php.net to get a copy of this message | ||
if you want to force a download, you could use this:
<?php
// download.php?name=filename
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=".$_GET["name"]);
@readfile('./'.$_GET['name']);
?>
I used this so i force my users to donwload the file the uploaded, but realise that you set your
server free to download every file on it to you users. Then can download all file (including
database connecting passwd etc).
----
Manual Page -- http://www.php.net/manual/en/function.readfile.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33866
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33866&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33866&report=yes