File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/downloadimage.php
<?php
define('IN_CONTROL_PANEL', true);
require_once(dirname(dirname(__FILE__)) . '/api/iwp.php');
$iwp = IWP::Init('basic,functions', true);
$imagename = str_replace("\\", "/", $_GET['image']);
$imagename = $iwp->valid->FilterFilenameOnly($imagename);
$imagepath = IWP_IMAGES_PATH .'/'. $imagename;
if (!file_exists($imagepath)) {
die();
}
while (@ob_end_clean()) { }
$filesize = filesize($imagepath);
$showname = basename($imagepath);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=\"". $showname ."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ". $filesize);
$handle = fopen($imagepath, 'rb');
while (!feof($handle)) {
$buffer = fread($handle, 32768);
echo $buffer;
}
fclose($handle);
die();