$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.
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