Forum Moderators: coopster
http://www.website.com/download.php?filename=Rock+With+You.mp3
www.website.com/Rock With You.mp3
$filename=$_GET['filename'];
header("Content-disposition:attachment;filename=$filename");
header("Content-type:application/mp3");
readfile("$filename");
http://www.website.com/download.php?filename=Rock_With_You.mp3
http://www.website.com/download.php?filename=Rock+With+You.mp3
$filename=$_GET["filename"];
header("Content-disposition:attachment;filename=$filename");
header("Content-type:application/mp3");
readfile("$filename");
%20(space) did not work?
http://www.website.com/download.php?filename=Rock%20With%20You.mp3
<?php
$file=$_GET["filename"];
header("Content-disposition:attachment;filename=$file");
header("Content-type:application/mp3");
readfile("$file");
?>
http://www.website.com/download.php?filename=Rock%20With%20You.mp3
<?php
$file=$_GET["filename"];
header("Content-disposition:attachment;filename=$file");
...and I tried the %20 instead of +
<?php
$file=$_GET["filename"];
header("Content-Disposition: attachment; filename=".rawurlencode($file));
$filename=$_GET['filename'];
header("Content-type:application/mp3");
header("Content-Disposition:attachment;filename=\"$filename\"");
readfile("$filename");
The issue was not being able read the variable as a string. Single quotes won't work, and I think it's because it makes the variable literal if I am not mistaken.
Content-Disposition:attachment; filename="Rock With You.mp3"
...and the third is how email clients interpret the link from the download.php.
http://www.website.com/download.php?id=123