Hi,
I wrote a php script to convert a kazaa playlist to .m3u playlist in PHP. The code is hardcoded for the paths in my computer but the problem is that, when i run the script i want it to display a download dialog and let the user save the .m3u file to the disk.
I tried using the
Content-type: application/octet-stream
and
Content-Disposition: attachment; filename=playlist.m3u
headers but all it does is jus display the contents of the playlist in the browser. Heres the simpified code:
<?php
//Code for opening and processing
// the kazaa playlist goes here
//At this point, $data has the contents that needs to be
// saved as playlist.m3u
// On the following lines I TRY to force IE to
//open the download dialog:
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=playlist.m3u');
print $data;
?>
But all it displays is the contents of $data in the browser. I discovered one thing though, if i link to this script from another page, then everything works as intended. I jus dun get y it does work when directly called.
Ne help is greatly appreciated,