Why is there extra whitespace at the beginning of my file after I write it with PHP?

puzzledsptg

New Member
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 \[code\]<?php\[/code\] 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:\[code\]$stringData = "http://stackoverflow.com/questions/3924746/<?php\nheader('Content-type: audio/mp3');\n\nheader('Content-Disposition: attachment; filename=\"$name\"');\nreadfile(\"$name.mp3\");\n?>";$myFile = "matt/$name/download.php";$fh = fopen($myFile, 'w') or die("can't open file");fwrite($fh, $stringData);fclose($fh);\[/code\]
 
Back
Top