X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fattach.php;h=6d611cec0418534ce50f80bae09c0c3d7189587f;hb=731b19c025a9505286d94bb8251e843dadb80de1;hp=ca53081d9347ea764909a9445f0632fa820a539e;hpb=73b4faca5c7af506558eba6b7317d23551f1aefa;p=friendica.git diff --git a/include/attach.php b/include/attach.php old mode 100644 new mode 100755 index ca53081d93..6d611cec04 --- a/include/attach.php +++ b/include/attach.php @@ -1,7 +1,7 @@ 'audio/mpeg', + 'wav' => 'audio/wav', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', 'ogg' => 'application/ogg', @@ -61,20 +62,22 @@ function mime_content_type($filename) { 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', ); - if(strpos($filename,'.') !== false) { - $ext = strtolower(array_pop(explode('.',$filename))); + $dot = strpos($filename,'.'); + if($dot !== false) { + $ext = strtolower(substr($filename,$dot+1)); if (array_key_exists($ext, $mime_types)) { return $mime_types[$ext]; } } - elseif (function_exists('finfo_open')) { - $finfo = finfo_open(FILEINFO_MIME); - $mimetype = finfo_file($finfo, $filename); - finfo_close($finfo); - return $mimetype; - } +// can't use this because we're just passing a name, e.g. not a file that can be opened +// elseif (function_exists('finfo_open')) { +// $finfo = @finfo_open(FILEINFO_MIME); +// $mimetype = @finfo_file($finfo, $filename); +// @finfo_close($finfo); +// return $mimetype; +// } else { return 'application/octet-stream'; } -}} +}