Content-type header php to download file

Zend - Free download as Word Doc (.doc / .docx), PDF File (.pdf), Text File (.txt) or read online for free. Zend

$file = $download['link']; //this is url of file - http://yours…m/..yourfile $file_location = $_Server['Document_ROOT'] . substr($file, strpos($file, '/wp-content')) // this is real path /var/www/.. header('Content-Description…Simple PHP File Download Scripthttps://mobeigi.com/blog/simple-php-file-download-scriptGet the source code for a simple PHP file download script that can force downloads for any file type.

View Responses; JSON Responses; File Downloads; File Responses The json method will automatically set the Content-Type header to application/json , as 

A set of PHP HTTP Headers for file downloads that actually works in all modern browsers (and for many different file types). Yay!

In PHP, the request is represented by some global variables ($_GET, $_POST, $_F. a Symfony application, you must require the vendor/autoload.php file in your code While creating this header for basic file downloads is straightforward, using The JsonResponse class sets the Content-Type header to application/json