pinkotoad
09-02-2002, 06:57 AM
I actually saw this script here, but I'm having trouble with it. What I want is it to FORCE the download.
<?
$saveName = stripslashes($HTTP_GET_VARS["name"]);
$savePath = stripslashes($HTTP_GET_VARS["path"]);
header ("Content-Type: application/octet-stream");
header ("Content-Disposition: attachment; filename=$saveName");
header ("Content-Transfer-Encoding: binary");
readfile($savePath);
?>
When i put in a query string like this:
<a href="download.php?path=mp3/backuponmyfeet.mp3&name=backuponmyfeet.mp3">
I get a page that says:
Warning: Cannot add header information - headers already sent by (output started at /home/ainsoftc/public_html/glen/download.php:1) in /home/ainsoftc/public_html/glen/download.php on line 6
Warning: Cannot add header information - headers already sent by (output started at /home/ainsoftc/public_html/glen/download.php:1) in /home/ainsoftc/public_html/glen/download.php on line 7
Thanks for any help.
<?
$saveName = stripslashes($HTTP_GET_VARS["name"]);
$savePath = stripslashes($HTTP_GET_VARS["path"]);
header ("Content-Type: application/octet-stream");
header ("Content-Disposition: attachment; filename=$saveName");
header ("Content-Transfer-Encoding: binary");
readfile($savePath);
?>
When i put in a query string like this:
<a href="download.php?path=mp3/backuponmyfeet.mp3&name=backuponmyfeet.mp3">
I get a page that says:
Warning: Cannot add header information - headers already sent by (output started at /home/ainsoftc/public_html/glen/download.php:1) in /home/ainsoftc/public_html/glen/download.php on line 6
Warning: Cannot add header information - headers already sent by (output started at /home/ainsoftc/public_html/glen/download.php:1) in /home/ainsoftc/public_html/glen/download.php on line 7
Thanks for any help.