Ver Mensaje Individual
  #8 (permalink)  
Antiguo 31/03/2010, 14:52
Hidek1
Colaborador
 
Fecha de Ingreso: octubre-2009
Ubicación: Tokyo - Japan !
Mensajes: 3.867
Antigüedad: 14 años, 7 meses
Puntos: 334
Respuesta: problema con header

quitale la primera condicional y cambiale el nombre a otro
te dejo la function modificada

Código PHP:
Ver original
  1. function getMime($filename) {
  2.     $mime_types = array(
  3.     'txt' => 'text/plain',
  4.     'htm' => 'text/html',
  5.     'html' => 'text/html',
  6.     'php' => 'text/html',
  7.     'css' => 'text/css',
  8.     'js' => 'application/javascript',
  9.     'json' => 'application/json',
  10.     'xml' => 'application/xml',
  11.     'swf' => 'application/x-shockwave-flash',
  12.     'flv' => 'video/x-flv',
  13.    
  14.     // images
  15.     'png' => 'image/png',
  16.     'jpe' => 'image/jpeg',
  17.     'jpeg' => 'image/jpeg',
  18.     'jpg' => 'image/jpeg',
  19.     'gif' => 'image/gif',
  20.     'bmp' => 'image/bmp',
  21.     'ico' => 'image/vnd.microsoft.icon',
  22.     'tiff' => 'image/tiff',
  23.     'tif' => 'image/tiff',
  24.     'svg' => 'image/svg+xml',
  25.     'svgz' => 'image/svg+xml',
  26.    
  27.     // archives
  28.     'zip' => 'application/zip',
  29.     'rar' => 'application/x-rar-compressed',
  30.     'exe' => 'application/x-msdownload',
  31.     'msi' => 'application/x-msdownload',
  32.     'cab' => 'application/vnd.ms-cab-compressed',
  33.    
  34.     // audio/video
  35.     'mp3' => 'audio/mpeg',
  36.     'qt' => 'video/quicktime',
  37.     'mov' => 'video/quicktime',
  38.    
  39.     // adobe
  40.     'pdf' => 'application/pdf',
  41.     'psd' => 'image/vnd.adobe.photoshop',
  42.     'ai' => 'application/postscript',
  43.     'eps' => 'application/postscript',
  44.     'ps' => 'application/postscript',
  45.    
  46.     // ms office
  47.     'doc' => 'application/msword',
  48.     'rtf' => 'application/rtf',
  49.     'xls' => 'application/vnd.ms-excel',
  50.     'ppt' => 'application/vnd.ms-powerpoint',
  51.    
  52.     // open office
  53.     'odt' => 'application/vnd.oasis.opendocument.text',
  54.     'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
  55.     );
  56.     $ext = explode('.',$filename);
  57.     $ext = array_pop($ext);
  58.     $ext = strtolower($ext);
  59.     if (array_key_exists($ext, $mime_types)) {
  60.         return $mime_types[$ext];
  61.     }elseif(function_exists('finfo_open')){
  62.         $finfo = finfo_open(FILEINFO_MIME);
  63.         $mimetype = finfo_file($finfo, $filename);
  64.         finfo_close($finfo);
  65.         return $mimetype;
  66.     }else{
  67.         return 'application/octet-stream';
  68.     }
  69. }
__________________
More about me...
~ @rhyudek1
~ Github