Google Mime Types


/ Published in: C++
Save to your folder(s)

Returns the Mime Types of documents used by google


Copy this code and paste it in your HTML
  1. // Mime types defined by Google.
  2. // Author : Selva Kumar
  3. // Blog : slvakumr.com
  4. // Date : 30 October 2014
  5.  
  6. function GetMimeType (filetype) {
  7. var mimeType = '';
  8. switch(filetype) {
  9. case 'zip':
  10. mimeType = MimeType.ZIP
  11. break
  12. case 'svg':
  13. mimeType = MimeType.SVG
  14. break
  15. case 'rtf':
  16. mimeType = MimeType.RTF
  17. break
  18. case 'png':
  19. mimeType = MimeType.PNG
  20. break
  21. case 'txt':
  22. mimeType = MimeType.PLAIN_TEXT
  23. break
  24. case 'pdf':
  25. mimeType = MimeType.PDF
  26. break
  27. case 'opendoc_text':
  28. mimeType = MimeType.OPENDOCUMENT_TEXT
  29. break
  30. case 'opendoc_spreadsheet':
  31. mimeType = MimeType.OPENDOCUMENT_SPREADSHEET
  32. break
  33. case 'opendoc_presentation':
  34. mimeType = MimeType.OPENDOCUMENT_PRESENTATION
  35. break
  36. case 'opendoc_graphics':
  37. mimeType = MimeType.OPENDOCUMENT_GRAPHICS
  38. break
  39. case 'word_legacy':
  40. mimeType = MimeType.MICROSOFT_WORD_LEGACY
  41. break
  42. case 'word':
  43. mimeType = MimeType.MICROSOFT_WORD
  44. break
  45. case 'powerpoint_legacy':
  46. mimeType = MimeType.MICROSOFT_POWERPOINT_LEGACY
  47. break
  48. case 'powerpoint':
  49. mimeType = MimeType.MICROSOFT_POWERPOINT
  50. break
  51. case 'excel_legacy':
  52. mimeType = MimeType.MICROSOFT_EXCEL_LEGACY
  53. break
  54. case 'excel':
  55. mimeType = MimeType.MICROSOFT_EXCEL
  56. break
  57. case 'jpeg':
  58. mimeType = MimeType.JPEG
  59. break
  60. case 'javascript':
  61. mimeType = MimeType.JAVASCRIPT
  62. break
  63. case 'html':
  64. mimeType = MimeType.HTML
  65. break
  66. case 'slides': case 'slide':
  67. mimeType = MimeType.GOOGLE_SLIDES
  68. break
  69. case 'spreadsheet': case 'spreadsheets':
  70. mimeType = MimeType.GOOGLE_SHEETS
  71. break
  72. case 'forms': case 'form':
  73. mimeType = MimeType.GOOGLE_FORMS
  74. break
  75. case 'drawings': case 'drawing':
  76. mimeType = MimeType.GOOGLE_DRAWINGS
  77. break
  78. case 'docs': case 'doc':
  79. mimeType = MimeType.GOOGLE_DOCS
  80. break
  81. case 'script':
  82. mimeType = MimeType.GOOGLE_APPS_SCRIPT
  83. break
  84. case 'gif':
  85. mimeType = MimeType.GIF
  86. break
  87. case 'directory':
  88. mimeType = MimeType.FOLDER
  89. break
  90. case 'folder':
  91. mimeType = MimeType.FOLDER
  92. break
  93. case 'csv':
  94. mimeType = MimeType.CSV
  95. break
  96. case 'css':
  97. mimeType = MimeType.CSS
  98. break
  99. case 'bmp':
  100. mimeType = MimeType.BMP
  101. break
  102. default:
  103. mimeType = null;
  104. break
  105. }
  106. return mimeType;
  107. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.