Categories
Snaps
Search
Register
Contact
API
Force file download
Forces a file download
<? if (ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } $ctype="application/force-download"; 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"); header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit; ?>
Usage
Set $filename to the full path of the file and paste the code below that.
Comments
Add your comment
Search
Login
Coder: scriptworkz
View more snaps from scriptworkz
View scriptworkz's profile
Rate this snap
Rating:
4
/ 5 (
1
votes) 864 views
Custom class generator
Selected snaps:
None selected yet.
Hot PHP snaps
PHP image slideshow auto
PHP pagination class
Bootstrap PHP code
Clean URL
PHP ffmpeg Upload Script
Rijndael 256 bit encryption using mcrypt
generate a preview image from an FLV file on-the-fly, or to save
Median calculator
Partners
PHP Site
PHPSnips
Comments