pythontr.com
Aşağıda vereceğimiz kod PHP programlama dili ile kullanabileceğiniz ve site üzerinden dosyalarınızı indirme için kullanabileceğiniz bir örnek çalışmamızdır.
$attachment = ''deneme.jpg; $file = './files/media/'.$attachment; $mime = get_mime_by_extension($file); if(file_exists($file)) { ob_clean(); header('Content-Type: '.$mime); header('Content-Disposition: attachment; filename='.basename($attachment)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); ob_clean(); flush(); exit; }
Yorumlar