kahoz Posted June 18, 2006 at 12:35 AM Report #33522 Posted June 18, 2006 at 12:35 AM Acho que isto vai fazer falta a alguém. Por isso fica o registo 😉 <?php $mimetypes = array( 'ez' => 'application/andrew-inset', 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => 'application/octet-stream', 'dms' => 'application/octet-stream', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'exe' => 'application/octet-stream', 'class' => 'application/octet-stream', 'so' => 'application/octet-stream', 'dll' => 'application/octet-stream', 'oda' => 'application/oda', 'pdf' => 'application/pdf', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', 'smi' => 'application/smil', 'smil' => 'application/smil', 'mif' => 'application/vnd.mif', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'wbxml' => 'application/vnd.wap.wbxml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'bcpio' => 'application/x-bcpio', 'vcd' => 'application/x-cdlink', 'pgn' => 'application/x-chess-pgn', 'cpio' => 'application/x-cpio', 'csh' => 'application/x-csh', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'dxr' => 'application/x-director', 'dvi' => 'application/x-dvi', 'spl' => 'application/x-futuresplash', 'gtar' => 'application/x-gtar', 'hdf' => 'application/x-hdf', 'js' => 'application/x-javascript', 'skp' => 'application/x-koan', 'skd' => 'application/x-koan', 'skt' => 'application/x-koan', 'skm' => 'application/x-koan', 'latex' => 'application/x-latex', 'nc' => 'application/x-netcdf', 'cdf' => 'application/x-netcdf', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'swf' => 'application/x-shockwave-flash', 'sit' => 'application/x-stuffit', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texinfo' => 'application/x-texinfo', 'texi' => 'application/x-texinfo', 't' => 'application/x-troff', 'tr' => 'application/x-troff', 'roff' => 'application/x-troff', 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'ms' => 'application/x-troff-ms', 'ustar' => 'application/x-ustar', 'src' => 'application/x-wais-source', 'xhtml' => 'application/xhtml+xml', 'xht' => 'application/xhtml+xml', 'zip' => 'application/zip', 'au' => 'audio/basic', 'snd' => 'audio/basic', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'kar' => 'audio/midi', 'mpga' => 'audio/mpeg', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'aif' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'm3u' => 'audio/x-mpegurl', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'wav' => 'audio/x-wav', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-xyz', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'ief' => 'image/ief', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png', 'tiff' => 'image/tiff', 'tif' => 'image/tiff', 'djvu' => 'image/vnd.djvu', 'djv' => 'image/vnd.djvu', 'wbmp' => 'image/vnd.wap.wbmp', 'ras' => 'image/x-cmu-raster', 'pnm' => 'image/x-portable-anymap', 'pbm' => 'image/x-portable-bitmap', 'pgm' => 'image/x-portable-graymap', 'ppm' => 'image/x-portable-pixmap', 'rgb' => 'image/x-rgb', 'xbm' => 'image/x-xbitmap', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-xwindowdump', 'igs' => 'model/iges', 'iges' => 'model/iges', 'msh' => 'model/mesh', 'mesh' => 'model/mesh', 'silo' => 'model/mesh', 'wrl' => 'model/vrml', 'vrml' => 'model/vrml', 'css' => 'text/css', 'html' => 'text/html', 'htm' => 'text/html', 'asc' => 'text/plain', 'txt' => 'text/plain', 'rtx' => 'text/richtext', 'rtf' => 'text/rtf', 'sgml' => 'text/sgml', 'sgm' => 'text/sgml', 'tsv' => 'text/tab-separated-values', 'wml' => 'text/vnd.wap.wml', 'wmls' => 'text/vnd.wap.wmlscript', 'etx' => 'text/x-setext', 'xsl' => 'text/xml', 'xml' => 'text/xml', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpe' => 'video/mpeg', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', 'mxu' => 'video/vnd.mpegurl', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'ice' => 'x-conference/x-cooltalk', ); ?> abraço! -lopes.
kingless Posted June 18, 2006 at 01:09 AM Report #33526 Posted June 18, 2006 at 01:09 AM Muito bom!! 😄 Foste tu que fizeste este array ?
kahoz Posted June 18, 2006 at 10:29 PM Author Report #33675 Posted June 18, 2006 at 10:29 PM encontrei na rede.. abraço 😉 -lopes.
karva Posted July 6, 2006 at 02:28 PM Report #36581 Posted July 6, 2006 at 02:28 PM tass, tnks, tava mm a precisar disso... Proud LEIC-A@IST student!
skin Posted July 6, 2006 at 02:46 PM Report #36586 Posted July 6, 2006 at 02:46 PM eu gravei isto tal e qual e abri no meu servidor e não deu nada! normalmente aparece sempre os scripts PHP por isso não penso que seja configuração do server...!help Our lives begin to end the day we become silent about things that matter - Martin Luther King
Gurzi Posted July 6, 2006 at 02:55 PM Report #36587 Posted July 6, 2006 at 02:55 PM Podes me dar um exemplo de utilização de mimetypes ?
M6 Posted July 6, 2006 at 04:40 PM Report #36620 Posted July 6, 2006 at 04:40 PM Podes me dar um exemplo de utilização de mimetypes ? A utilização mais comum é em páginas web, por exemplo um swf é do tipo application/x-shockwave-flash e um mp4 é do tipo audio/mp4 ou video/mp4 (isto no meu sistema, no teu pode ser diferente). Outra utilização comum é, por exemplo, os attachments enviados por emai. Outra utilização é, por exemplo, o envio por email dos dados submetidos num formulário, se o formulário for definido como "text/plain" os dados vão de uma forma, se for "text/html" vão de outra forma. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar."
Ped@ntilva Posted July 11, 2006 at 12:04 PM Report #37492 Posted July 11, 2006 at 12:04 PM Isto dá mesmo muito geito. Aconselho a irem ao manual PHP para verem que potencialidades que isto traz. Thks pelo post Os mimetypes são bem vindos.
kingless Posted August 10, 2006 at 04:35 PM Report #43632 Posted August 10, 2006 at 04:35 PM Os mimetypes são muito utilizados no PHP para definir os headers... Header( 'Content-Type: application/x-javascript' );
kingless Posted August 22, 2006 at 04:35 PM Report #45948 Posted August 22, 2006 at 04:35 PM Ainda bem que colocaram isto aqui 😄 isto vai-me ser muito útil.
-IceBurn- Posted November 5, 2006 at 04:27 PM Report #62223 Posted November 5, 2006 at 04:27 PM Porreiro! Muito util mesmo! 😉
kingless Posted February 3, 2007 at 03:43 PM Report #80043 Posted February 3, 2007 at 03:43 PM Acabei de criar um pequeno script para detectar o mime type de ficheiros aqui fica o código Download: http://www.kingless.net/download.php?filename=mime_type.php <?php ///////////////////////////////////////// //// File Mime types //// /// kingless - <blastelf@gmail.com> /// // 03/02/2007 // ///////////////////////////////////////// $file = "mime_type.php"; echo mime_type( $file ); function mime_type( $file ) { $filetype = substr(strrchr( $file, '.' ), 1 ); $mimetypes = array( "ez" => "application/andrew-inset", "atom" => "application/atom+xml", "hqx" => "application/mac-binhex40", "cpt" => "application/mac-compactpro", "doc" => "application/msword", "lha" => "application/octet-stream", "lzh" => "application/octet-stream", "exe" => "application/octet-stream", "so" => "application/octet-stream", "dms" => "application/octet-stream", "class" => "application/octet-stream", "bin" => "application/octet-stream", "dll" => "application/octet-stream", "oda" => "application/oda", "pdf" => "application/pdf", "ps" => "application/postscript", "eps" => "application/postscript", "ai" => "application/postscript", "smi" => "application/smil", "smil" => "application/smil", "mif" => "application/vnd.mif", "xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint", "wbxml" => "application/vnd.wap.wbxml", "wmlc" => "application/vnd.wap.wmlc", "wmlsc" => "application/vnd.wap.wmlscriptc", "bcpio" => "application/x-bcpio", "vcd" => "application/x-cdlink", "pgn" => "application/x-chess-pgn", "cpio" => "application/x-cpio", "csh" => "application/x-csh", "dir" => "application/x-director", "dxr" => "application/x-director", "dcr" => "application/x-director", "dvi" => "application/x-dvi", "spl" => "application/x-futuresplash", "gtar" => "application/x-gtar", "gz" => "application/x-gzip", "hdf" => "application/x-hdf", "php" => "application/x-httpd-php", "phps" => "application/x-httpd-php-source", "js" => "application/x-javascript", "skm" => "application/x-koan", "skt" => "application/x-koan", "skp" => "application/x-koan", "skd" => "application/x-koan", "latex" => "application/x-latex", "cdf" => "application/x-netcdf", "nc" => "application/x-netcdf", "sh" => "application/x-sh", "shar" => "application/x-shar", "swf" => "application/x-shockwave-flash", "sit" => "application/x-stuffit", "sv4cpio" => "application/x-sv4cpio", "sv4crc" => "application/x-sv4crc", "tar" => "application/x-tar", "tcl" => "application/x-tcl", "tex" => "application/x-tex", "texi" => "application/x-texinfo", "texinfo" => "application/x-texinfo", "roff" => "application/x-troff", "t" => "application/x-troff", "tr" => "application/x-troff", "man" => "application/x-troff-man", "me" => "application/x-troff-me", "ms" => "application/x-troff-ms", "ustar" => "application/x-ustar", "src" => "application/x-wais-source", "xht" => "application/xhtml+xml", "xhtml" => "application/xhtml+xml", "zip" => "application/zip", "au" => "audio/basic", "snd" => "audio/basic", "midi" => "audio/midi", "kar" => "audio/midi", "mid" => "audio/midi", "mp3" => "audio/mpeg", "mp2" => "audio/mpeg", "mpga" => "audio/mpeg", "aifc" => "audio/x-aiff", "aif" => "audio/x-aiff", "aiff" => "audio/x-aiff", "m3u" => "audio/x-mpegurl", "rm" => "audio/x-pn-realaudio", "ram" => "audio/x-pn-realaudio", "rpm" => "audio/x-pn-realaudio-plugin", "ra" => "audio/x-realaudio", "wav" => "audio/x-wav", "pdb" => "chemical/x-pdb", "xyz" => "chemical/x-xyz", "bmp" => "image/bmp", "gif" => "image/gif", "ief" => "image/ief", "jpe" => "image/jpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "png" => "image/png", "tif" => "image/tiff", "tiff" => "image/tiff", "djvu" => "image/vnd.djvu", "djv" => "image/vnd.djvu", "wbmp" => "image/vnd.wap.wbmp", "ras" => "image/x-cmu-raster", "pnm" => "image/x-portable-anymap", "pbm" => "image/x-portable-bitmap", "pgm" => "image/x-portable-graymap", "ppm" => "image/x-portable-pixmap", "rgb" => "image/x-rgb", "xbm" => "image/x-xbitmap", "xpm" => "image/x-xpixmap", "xwd" => "image/x-xwindowdump", "igs" => "model/iges", "iges" => "model/iges", "mesh" => "model/mesh", "silo" => "model/mesh", "msh" => "model/mesh", "vrml" => "model/vrml", "wrl" => "model/vrml", "css" => "text/css", "htm" => "text/html", "html" => "text/html", "asc" => "text/plain", "txt" => "text/plain", "rtx" => "text/richtext", "rtf" => "text/rtf", "sgml" => "text/sgml", "sgm" => "text/sgml", "tsv" => "text/tab-separated-values", "wml" => "text/vnd.wap.wml", "wmls" => "text/vnd.wap.wmlscript", "etx" => "text/x-setext", "xml" => "text/xml", "xsl" => "text/xml", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mov" => "video/quicktime", "qt" => "video/quicktime", "mxu" => "video/vnd.mpegurl", "avi" => "video/x-msvideo", "movie" => "video/x-sgi-movie", "ice" => "x-conference/x-cooltalk" ); return implode( '', array_keys( array_flip( $mimetypes ), $filetype )); } ?>
djthyrax Posted February 3, 2007 at 03:50 PM Report #80045 Posted February 3, 2007 at 03:50 PM E usar a função pathinfo()? nada? 😄 Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum!
kingless Posted February 3, 2007 at 04:06 PM Report #80052 Posted February 3, 2007 at 04:06 PM Cada um utiliza a função que quer e/ou acha melhor desde que consiga obter o resultado pretendido isso é que importa. 😄 PS: Já agora aproveito para dizer que o php tem uma função que detecta o mime_type mas não é la muito boa http://pt.php.net/mime_content_type
djthyrax Posted February 3, 2007 at 04:51 PM Report #80069 Posted February 3, 2007 at 04:51 PM Apenas apontei a pathinfo() porque quem andar por aqui pode interessar-se por ela já que é bastante útil 😄 Essa função (mime_content_type()) foi descontinuada e substituida pela pathinfo() 😛 Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum!
kingless Posted February 3, 2007 at 05:43 PM Report #80097 Posted February 3, 2007 at 05:43 PM Apenas apontei a pathinfo() porque quem andar por aqui pode interessar-se por ela já que é bastante útil 😄 Essa função (mime_content_type()) foi descontinuada e substituida pela pathinfo() 😛 Deves estar a confundir as duas funções... mime_content_type só mostra o mime type do ficheiro tipo "application/octet-stream" pathinfo mostra a extensão do ficheiro, o nome do directório e o nome do ficheiro Corrigi-me se estiver errado 😛 Como é que pode a função mime_content_type() ser substituida pela função pathinfo() se as duas funções fazem coisas completamente diferentes ?
djthyrax Posted February 3, 2007 at 07:35 PM Report #80109 Posted February 3, 2007 at 07:35 PM Como é que pode a função mime_content_type() ser substituida pela função pathinfo() se as duas funções fazem coisas completamente diferentes ? See Also Fileinfo for a replacement Eu disse que tinha sido descontinuada e substituida pela pathinfo(). E se leres melhor também vês lá: NotesWarning This function has been deprecated as the PECL extension Fileinfo provides the same functionality (and more) in a much cleaner way. Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum!
kingless Posted February 3, 2007 at 07:40 PM Report #80112 Posted February 3, 2007 at 07:40 PM Não estou a perceber.. ? O que é que Fileinfo tem a ver com pathinfo ? Onde é que diz que o mime_content_type foi substitudido por pathinfo ? EDIT: Eu já sabia que ela tinha sido descontinuada porque lá diz mesmo "mime_content_type — Detect MIME Content-type for a file (deprecated)" só não entendo como é que tu dizes que essa função foi substituída por pathinfo(); explica melhor isso.
djthyrax Posted February 3, 2007 at 07:48 PM Report #80117 Posted February 3, 2007 at 07:48 PM Ok esquece, eu é que li mal o que estava na página 😕 Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now