<?php
|
/*---------------------------------------------------------------*/
|
/*
|
Titre : Retourne le Content-Type correspondant à un fichier
|
|
URL : https://phpsources.net/code_s.php?id=58
|
Auteur : Mathieu
|
Date édition : 01 Sept 2004
|
Date mise à jour : 26 Sept 2019
|
Rapport de la maj:
|
- fonctionnement du code vérifié
|
*/
|
/*---------------------------------------------------------------*/
|
|
function GetMIME($ext){
|
$ext=strrchr($ext,".");
|
switch(strtoupper($ext)){
|
case ".DWG": return "application/acad;"; break;
|
case ".CCAD": return "application/clariscad;"; break;
|
case ".DRW": return "application/drafting;"; break;
|
case ".DXF": return "application/dxf;"; break;
|
case ".UNV": return "application/i-deas;"; break;
|
case ".IGS": return "application/iges;"; break;
|
case ".IGES": return "application/iges;"; break;
|
case ".ODA": return "application/oda;"; break;
|
case ".PDF": return "application/pdf;"; break;
|
case ".AI": return "application/postscript;";break;
|
case ".PS": return "application/postscript;";break;
|
case ".EPS": return "application/postscript;";break;
|
case ".PRT": return "application/pro_eng;"; break;
|
case ".RTF": return "application/rtf;"; break;
|
case ".SET": return "application/set;"; break;
|
case ".STL": return "application/sla;"; break;
|
case ".SOL": return "application/solids;"; break;
|
case ".STEP": return "application/STEP;"; break;
|
case ".STP": return "application/STEP;"; break;
|
case ".VDA": return "application/vda;"; break;
|
case ".MIF": return "application/x-mif;"; break;
|
case ".CSH": return "application/x-csh;"; break;
|
case ".DVI": return "application/x-dvi;"; break;
|
case ".HDF": return "application/x-hdf;"; break;
|
case ".LATEX": return "application/x-latex;"; break;
|
case ".CDF": return "application/x-netcdf;"; break;
|
case ".NC": return "application/x-netcdf;"; break;
|
case ".SH": return "application/x-sh;"; break;
|
case ".TCL": return "application/x-tcl;"; break;
|
case ".TEX": return "application/x-tex;"; break;
|
case ".TEXI": return "application/x-texinfo;"; break;
|
case ".TEXINFO":return "application/x-texinfo;"; break;
|
case ".TR": return "application/x-troff;"; break;
|
case ".ROFF": return "application/x-troff;"; break;
|
case ".T": return "application/x-troff;"; break;
|
case ".MAN": return "application/x-troff-man;";break;
|
case ".ME": return "application/x-troff-me;";break;
|
case ".MS": return "application/x-troff-ms;";break;
|
case ".SRC": return "application/x-wais-source;";break;
|
case ".ZIP": return "application/zip;"; break;
|
case ".BCPIO": return "application/x-bcpio;"; break;
|
case ".CPIO": return "application/x-cpio;"; break;
|
case ".GTAR": return "application/x-gtar;"; break;
|
case ".SHAR": return "application/x-shar;"; break;
|
case ".SV4CPIO":return "application/x-sv4cpio;"; break;
|
case ".SV4CRC": return "application/x-sv4crc;"; break;
|
case ".TAR": return "application/x-tar;"; break;
|
case ".USTAR": return "application/x-ustar;"; break;
|
case ".AU": return "audio/basic;"; break;
|
case ".SND": return "audio/basic;"; break;
|
case ".AIF": return "audio/x-aiff;"; break;
|
case ".AIFF": return "audio/x-aiff;"; break;
|
case ".AIFC": return "audio/x-aiff;"; break;
|
case ".WAV": return "audio/x-wav;"; break;
|
case ".GIF": return "image/gif;"; break;
|
case ".IEF": return "image/ief;"; break;
|
case ".JPG": return "image/jpeg;"; break;
|
case ".JPEG": return "image/jpeg;"; break;
|
case ".JPE": return "image/jpeg;"; break;
|
case ".TIFF": return "image/tiff;"; break;
|
case ".TIF": return "image/tiff;"; break;
|
case ".RAS": return "image/x-cmu-raster;"; break;
|
case ".PNM": return "image/x-portable-anymap;"; break;
|
case ".PBM": return "image/x-portable-bitmap;"; break;
|
case ".PGM": return "image/x-portable-graymap;";break;
|
case ".PPM": return "image/x-portable-pixmap;"; break;
|
case ".RGB": return "image/x-rgb;"; break;
|
case ".XBM": return "image/x-xbitmap;"; break;
|
case ".XPM": return "image/x-xpixmap;"; break;
|
case ".XWD": return "image/x-xwindowdump;"; break;
|
case ".ZIP": return "multipart/x-zip;"; break;
|
case ".GZIP": return "multipart/x-gzip;"; break;
|
case ".HTM": return "text/html; charset=\"iso-8859-1\";"; break;
|
case ".HTML": return "text/html; charset=\"iso-8859-1\";"; break;
|
case ".G": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".H": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".C": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".CC": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".HH": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".M": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".F90": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".TXT": return "text/plain; charset=\"iso-8859-1\";"; break;
|
case ".TRX": return "text/richtext;"; break;
|
case ".TSV": return "text/tab-separated-values;";break;
|
case ".ETX": return "text/x-setext;"; break;
|
case ".MPG": return "video/mpeg;"; break;
|
case ".MPE": return "video/mpeg;"; break;
|
case ".MPEG": return "video/mpeg;"; break;
|
case ".QT": return "video/quicktime;"; break;
|
case ".MOV": return "video/quicktime;"; break;
|
case ".AVI": return "video/x-msvideo;"; break;
|
case ".MOVIE": return "video/x-sgi-movie;"; break;
|
default: return "application/octet-stream;"; break;
|
}
|
}
|
?>
|
|
|