note 62302 added to function.readfile

From: Date: Fri, 24 Feb 2006 16:47:53 +0000
Subject: note 62302 added to function.readfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-104372@lists.php.net to get a copy of this message
[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>"); ---- Server IP: 80.241.173.254 Probable Submitter: 193.109.40.21 ---- Manual Page -- http://www.php.net/manual/en/function.readfile.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62302 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62302&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62302&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104372) next »