views:

21

answers:

1

Hey, I'm trying to change the name of a file being downloaded through my site off an external server.

Currently whenever I modify the header information, it just takes a reallllllyyyyyy long time for the download to start, so is there any way to do it without changing the headers? Or if not any reason why it would be taking forever to load with my headers?

This is what I'm doing

        @header("Cache-Control: no-cache, must-revalidate");
        @header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
        @header("Content-Length: ".getfilesize($url));
        @header("Content-Disposition: attachment; filename=".$name);
        @header("Content-type: audio/mpeg;\r\n");
        die(@readfile($url));

Could it be done in javascript or something instead? And could i make it so all downloads start without opening in like windows media player, quicktime etc.

Thanks :)

+1  A: 

It takes a "reallllllyyyyyy long time" because your loading the file to your server first and then send it to the client everytime someone is clicking the download link.

middus
thanks! :) Is there any way I could do it without loading it to my server first?
Belgin Fish