Code: Select all
$handle = @fopen($file_path, "rb");
if($handle !== false)
{
//Get file length for output
$length = /*ob_get_length() +*/ filesize($file_path);
//Send contents
header("Pragma: private");
header("Cache-control: private, must-revalidate");
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: Binary");
header("Accept-Ranges: bytes");
header("Content-Length: $length");
header("Content-Disposition: attachment; filename=\"".$outputFile."\"");
header("Connection: close");
$contents = fread($handle, filesize($file_path));
//Change contents in $contents
//Output contents
print $contents;
fclose($handle);
}