I need help with a problem in the tool that I am developing.
I need to download an external file and rename it, but without using readfile (), file_get_contents () or fread () (the files are too large to read them on the server and upload them again to the guest PC).
I tried first:
the code:
header("Location: http://www.example.com/example_download.zip");
It works for loading, but not for example_download.zip renaming.
So I tried with readfile ():
the code:
header("Content-Disposition: attachment; filename="example_download_2.zip"\n\n");
header("Content-Type: application/force-download");
readfile("http://www.example.com/example_download.zip");
exit;
It works well with the code above, first downloading the remote file on the server, renaming it and sending it to the visitor with a new name, but the use of the resources of this process is very large, as well as the use of bandwidth.
, , , . ?