Streaming File to the Browser
I hope you all are well. Today I am going to write post on How can make to user download the file from the another website without showing them that the file is actually coming from another server?
This can help many beginners PHP User to to Hide File URL Location in PHP. Here is the example how can u fetch file from other website and give download to the user like its downloading from our website.
Here is the Nice code:
$file="http://example.com/example.jpg"; // replace this URL with your URL
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Length: ' . filesize($file));
Very Easy to understand.
Ask if you Have any query.
Thank you.. 🙂