View Full Version : File downloading issues

07-27-2007, 10:50 AM
Well... I am running this function:

header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="ha.mp3"');

To more/less make the browser prompt to download the mp3... however, readfile causes the PHP to server-side read the file THEN spit out the promt to download, i need a readfile alternative so instead of reading the file, it will just automatically promt to download the file. because do to this being an offsite mp3, it takes really long to read it.

if there is no readfile alternatives... can i do it in JS somehow?

07-27-2007, 10:53 AM
You don't need readfile. Also I just tried it with readfile and the prompt is instant. I think your issue might be because you are using the absolute url. Have you tried using the relative path?

07-27-2007, 10:04 PM
The file i want it to download is off-site

07-27-2007, 10:07 PM
why is it off-site, why cant you host it on your site?/server?

07-28-2007, 02:33 AM
I am making an mp3 file ripper which rips mp3s from another site..

07-28-2007, 10:54 AM
which unless you have permission form the site owner is probably a bad thing so we can't really help you further.