note 94117 rejected from function.readfile by danbrown
| From: | danbrown@php.net | Date: | Sat, 17 Oct 2009 00:23:38 +0000 |
| Subject: | note 94117 rejected from function.readfile by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161828@lists.php.net to get a copy of this message | ||
Note Submitter: sjakie170 at hotmail dot com
----
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.