I am using a script like given below to open files stored *outside* the webroot directory for users to download. The problem is whenever the filesize exceeds 400,000 bytes, this script cannot open the file. It returns a blank page
Any idea what I shall do to get rid of this??
<?
define('FILEDIR', '/home/myhotboard.com/downloads/');
//storage directory outside the root
$path = FILEDIR . $file;
$mimetype = array(
'doc'=>'application/msword',
'htm'=>'text/html',
'html'=>'text/html',
'jpg'=>'image/jpeg',
'pdf'=>'application/pdf',
'txt'=>'text/plain',
'xls'=>'application/vnd.ms-excel'
);
$p = explode('.', $file);
$pc = count($p);
header("Content-type: application/force-download\n");
header("Content-disposition: attachment; filename="$file"\n");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($path) . "\n");
//send file contents
$fp=fopen($path, "r");
fpassthru($fp);
?>