Hello there,
I am trying to make my PHP script create a file and add headers into that file but the file must be PHP only and nothing before the PHP tags.
But the script is for some reason adding an extra blank line in the beginning before the <?php
and it does not work. I know this because when I manually edited it and removed the line it worked. Here is the script and thanks a lot:
$stringData = "<?php\n
header('Content-type: audio/mp3');\n
\n
header('Content-Disposition: attachment; filename=\"$name\"');\n
readfile(\"$name.mp3\");\n
?>";
$myFile = "matt/$name/download.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $stringData);
fclose($fh);