How To Force File Download With PHP

July 27, 2012 // In: PHP, Web Design

PHP allows you to change the HTTP headers of files, so that you can force a file to be downloaded that normally the browser would load in the same window. This is perfect for files like PDFs, document files, images, and video that you want your customers to download rather than read online. ( Jennifer Kyrnin )

Lets Start,
1. Upload file to the web server that you want to make available for download.

2. Create a New PHP file download.php

3. Open PHP file and copy paste following code

4. Link your php file as download link
<a href="download.php">Download</a>

How to Open a Link in a New Window using jQuery
Submit form using jquery .post