fox_statton
asked on
Why is this not working?
Ive got this simple code:
$id="info.gif";
$file = '/home/server/files/76/'.$ id;
header('Content-Descriptio n: File Transfer');
header('Content-Type: application/force-download ');
header('Content-Length: ' . filesize($filename));
header('Content-Dispositio n: attachment; filename=' . basename($file));
readfile($file);
It seems to find the file fine, but it prints out the entire contents.
If I put
$file = '/home/server/files/76/inf o.gif";
it works fine.
Anyone?
$id="info.gif";
$file = '/home/server/files/76/'.$
header('Content-Descriptio
header('Content-Type: application/force-download
header('Content-Length: ' . filesize($filename));
header('Content-Dispositio
readfile($file);
It seems to find the file fine, but it prints out the entire contents.
If I put
$file = '/home/server/files/76/inf
it works fine.
Anyone?
try this....
$id="info.gif";
$file = '/home/server/files/76/'.$ id;
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Descriptio n: File Transfer');
header('Content-Type: image/gif');
header('Content-Length: ' . filesize($file));
header('Content-Dispositio n: attachment; filename="'. basename($file)."\"");
readfile($file);
exit();
$id="info.gif";
$file = '/home/server/files/76/'.$
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Descriptio
header('Content-Type: image/gif');
header('Content-Length: ' . filesize($file));
header('Content-Dispositio
readfile($file);
exit();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is the code I have used for this:
$id="info.gif";
$file = "/home/server/files/76/".$
$mimetype = "image/gif"; // You should have a switch() block which sets the mimetype for different extensions.
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: ".$mimetype);
header("Content-Length: ".filesize($filename));
header("Content-Dispositio
Batalf