note 94117 added to function.readfile
| From: | sjakie170 at hotmail dot com | Date: | Fri, 16 Oct 2009 23:56:25 +0000 |
| Subject: | note 94117 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161827@lists.php.net to get a copy of this message | ||
Hello All
Im a total newby when it comes to php. Im just looking for a simple php script that will hide the
actual URL of the file.
I have found this piece of code on the net:
<?php
$name = $_REQUEST['file'] ;
$file = "download/location/".$name.".zip";
$contenttype="application/x-zip-compressed";
header("Content-Type: ".$contenttype);
header("Content-type: octet-stream");
header("Content-Length: ".filesize($file));
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header('Accept-Ranges: bytes');
header("Cache-Control: public");
header("Cache-Control: no-cache, must-revalidate");
header("Content-Description: File Transfer");
header('Content-Disposition: inline;
filename="'.basename($file).'"');
header("Content-Transfer-Encoding: binary\n");
header("Expires: 0");
header('Connection: close');
readfile($file);
exit();
?>
It will download the file but it goes very slow and besides that when the file is downloaded it wont
open the zip file cuz its damaged. What can i do or change so this script will work?
All help is apriciated.
----
Server IP: 83.137.20.135
Probable Submitter: 80.56.7.203
----
Manual Page -- http://www.php.net/manual/en/function.readfile.php
Edit -- https://master.php.net/note/edit/94117
Del: integrated -- https://master.php.net/note/delete/94117/integrated
Del: useless -- https://master.php.net/note/delete/94117/useless
Del: bad code -- https://master.php.net/note/delete/94117/bad+code
Del: spam -- https://master.php.net/note/delete/94117/spam
Del: non-english -- https://master.php.net/note/delete/94117/non-english
Del: in docs -- https://master.php.net/note/delete/94117/in+docs
Del: other reasons-- https://master.php.net/note/delete/94117
Reject -- https://master.php.net/note/reject/94117
Search -- https://master.php.net/manage/user-notes.php