note 69758 added to function.fread

From: Date: Tue, 19 Sep 2006 17:37:45 +0000
Subject: note 69758 added to function.fread
Groups: php.notes 
Request: Send a blank email to php-notes+get-117330@lists.php.net to get a copy of this message
The dl_file_resume function mentioned below can be improved by using the mime_content_type function. http://br.php.net/manual/pt_BR/function.mime-content-type.php before: <?php $file_extension = strtolower(substr(strrchr($filename,"."),1)); //This will set the Content-Type to the appropriate setting for the file switch( $file_extension ) { case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "mp3": $ctype="audio/mpeg"; break; case "mpg":$ctype="video/mpeg"; break; case "avi": $ctype="video/x-msvideo"; break; default: $ctype="application/force-download"; } //Use the switch-generated Content-Type header("Content-Type: $ctype"); ?> after: <?php header("Content-Type: ".mime_content_type($file)); ?> ---- Server IP: 200.185.109.13 Probable Submitter: 200.195.17.179 ---- Manual Page -- http://www.php.net/manual/en/function.fread.php Edit -- https://master.php.net/note/edit/69758 Del: integrated -- https://master.php.net/note/delete/69758/integrated Del: useless -- https://master.php.net/note/delete/69758/useless Del: bad code -- https://master.php.net/note/delete/69758/bad+code Del: spam -- https://master.php.net/note/delete/69758/spam Del: non-english -- https://master.php.net/note/delete/69758/non-english Del: in docs -- https://master.php.net/note/delete/69758/in+docs Del: other reasons-- https://master.php.net/note/delete/69758 Reject -- https://master.php.net/note/reject/69758 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117330) next »