i using the following code to force download files in php
<?PHP
$id =$_GET['id'];
$query = mysql_query("SELECT * FROM `blog` WHERE id = '" . $id . "' LIMIT 1")or die(mysql_error());
while($row = mysql_fetch_assoc($query)){
$file_name = $row[url]; // "wwyypyv6.pdf"
$file_type = $row[type]; // "application/pdf"
$file_url = 'http://emfhal.hostech.co.il/upload/' . $file_name;
}
header("Content-Type: " . $file_type);
header("Content-Disposition: attachment; filename=\"$file_name");
readfile($file_url);
exit();
?>
When I use this code to download this pdf file (only used for testing purposes), I open the downloaded , and all it gives me is an file empty. i tried it in chrome. opening it with windows and google chrome, it says that it can't display the pdf file because it is empty???