Hello,
I am currently using the code below to force the download of a file. It worked with my previous ISP, but it is not working with my new one. I printed the $filename and the path to the file prints out perfectly. But when I try to download the file I get the download window and a file downloads, but it's not the file that I want. If I right-click on it and look at it's properties the file type is just "file". It does this for each type of file that I am trying to download. It's almost as if it is not seeing the proper directory, but when I print out the $filename the path is correct.
Could this be a server configuration issue? Does anyone see anything wrong with my code?
Thanks in advance!!!
<?php
$path = $_GET['path'];
$name = $_GET['name'];
$filename = $path.$name;
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$name");
echo file_get_contents($filename);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>