I am looking to force the download of a file from an external source using PHP headers. However, the file type could be ANYTHING. How can I force the download of all file types?
I hope you can understand my question and what I am trying to describe.
You mean HTTP headers, and you're looking for RFC 2616, http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html "Content Disposition".
Send the following headers to force a download of ALL files and types:
header('Content-Disposition: attachment; filename="name.ext"');
header('Content-Type: application/octet-stream'); // or application/force-download
echo $the_file_content;
exit;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With