note 62302 deleted from function.readfile by philip

From: Date: Mon, 05 Mar 2007 06:23:37 +0000
Subject: note 62302 deleted from function.readfile by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-124082@lists.php.net to get a copy of this message
Note Submitter: Paladinux<francesco at paladinux dot net> ---- [2th Part of My MESSAGE] //UNDERSTEND EXTENSION TO RESOLVE IEXPLORER BUG // switch ($type) { case "exe": (($browser=='IE' || $browser=='OPERA')? ( $ctype="application/octetstream"):( $ctype="application/octet-stream")); break; case "pdf": $ctype="application/pdf"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpe": case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } //EXIST FILE? YES ->FORCEDOWNLOAD // NO ->DIE AND COME BACK IF IS POSSIBLE if (file_exists($file)) { header("Pragma: public"); header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: $ctype"); header('Content-Disposition: attachment; filename="'.$filename.'.'.$type.'"'); header("Content-Transfer-Encoding: binary"); header('Content-Length: '.filesize($abs_item)); set_time_limit(0); @readfile($abs_item) OR die("<html><body OnLoad=\"javascript: alert('Nessun file trovato');history.back();\" bgcolor=\"#F0F0F0\"></body></html>"); exit; }//fine if ($file) else die("<html><body OnLoad=\"javascript: alert('Nessun file da scaricare!');history.back();\" bgcolor=\"#F0F0F0\"></body></html>");

« previous php.notes (#124082) next »