note 69758 deleted from function.fread by nlopess
| From: | nlopess@php.net | Date: | Wed, 08 Nov 2006 22:54:22 +0000 |
| Subject: | note 69758 deleted from function.fread by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-119527@lists.php.net to get a copy of this message | ||
Note Submitter: fkjaekel at yahoo dot com dot br
----
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));
?>