I know how to change file name of local file in order to let's say protect file path
That would be something like
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="new_file_name.ext"');
readfile($original_file);
But I have problem doing that on remote file.
Problem is if I use readfile() on remote file, I guess that file is first downloaded on my server [streamed actually] and then to user, which really slows down transfer.
Is there a way to specify a file name for remote file?
The reason I need this is because I'm getting that remote file path via RSS, and path is in form http://www.site.com/song_download?fileid=1234
so every time someone clicks link for download, he gets "song_download" as file name in download dialog, and I would like to force it to "artist - song.mp3" or something like that, custom for each file