Hello,
I want code to mask a file link and I send the file to user browser directly for download with a different name without the file passing through my server using my bandwidth. how can I do that ?
so if the original file link is www.site.com/file.zip it shows like www.mysite.com/download.php?file=file2.zip
where the code for downloading file will be placed in download.php
I used
header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate ('D, d M Y H:i:s') . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . $title);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $size);
readfile ($newUrl);
where $title is the file name I want and $size is the size of the file and $newUrl is the url of the file.
Thanks in advance