Force Download PHP

Posted by engineerisaac

Posted on 7 months ago

$file = 'monkey.gif';

if (file_exists($file)) {

header('Content-Description: File Transfer');

header('Content-Type: application/octet-stream');

header('Content-Disposition: attachment; filename="'.basename($file).'"');

header('Expires: 0');

header('Cache-Control: must-revalidate');

header('Pragma: public');

header('Content-Length: ' . filesize($file));




Comments are For the Community.

If you would like to Comment, Consider joining the Community!

We believe in accountability. Your comments are connected to your profile.

Register Login

Other Engineerisaac Articles