Jump to content

[SOLVED] How to force a download? is that PHP?


benphp

Recommended Posts

<?php
//downloads the file
$file = 'file.jpg';
$fileurl = 'images/'.$file;
if(!file) {die('file not found');}
else {
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Transfer-Encoding: binary");
readfile($fileurl); }
exit;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.