[myad1] Everyone likes to download files from online but there is a script which helps us download any files from a server.  It’s a magic right? Yes, if you use below code then download magic will be happening.

To download files using the PHP code, you need to use below code. just replace your file name with an about-unity-blogger.pdf file and place it.

	$filename = 'about-unity-blogger.pdf';
	// required for IE, otherwise Content-disposition is ignored
		ini_set('zlib.output_compression', 'Off');

	header("Pragma: public"); // required
	header("Expires: 0");
	header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
	header("Cache-Control: private",false); // required for certain browsers
	header("Content-Type: $ctype");

	// change, added quotes to allow spaces in filenames
	header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
	header("Content-Transfer-Encoding: binary");
	header("Content-Length: ".filesize($filename));

Here is a demo to see how it works.