2 #include "NyLPC_cMimeType.h"
\r
3 struct TMimeTypeTable{
\r
5 const char* mimetype;
\r
7 const static struct TMimeTypeTable table[]=
\r
9 {"zip" ,"application/zip"},
\r
10 {"js" ,"application/x-javascript"},
\r
11 {"txt" ,"text/plain"},
\r
12 {"html","text/html"},
\r
13 {"htm","text/html"},
\r
14 {"css" ,"text/css"},
\r
15 {"jpeg","image/jpeg"},
\r
16 {"jpg" ,"image/jpeg"},
\r
17 {"png" ,"image/png"},
\r
18 {"gif" ,"image/gif"},
\r
21 const static char* default_mimetype="application/octet-stream";
\r
23 const char* NyLPC_cMiMeType_getFileName2MimeType(const char* i_file_name)
\r
26 const char* p=strrchr(i_file_name,'.');
\r
28 return default_mimetype;
\r
30 for(i=0;table[i].ext!=NULL;i++){
\r
31 if(NyLPC_stricmp(table[i].ext,p+1)==0){
\r
32 return table[i].mimetype;
\r
35 return default_mimetype;
\r