/ Published in: C++
Returns the Mime Types of documents used by google
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Mime types defined by Google. // Author : Selva Kumar // Blog : slvakumr.com // Date : 30 October 2014 function GetMimeType (filetype) { var mimeType = ''; switch(filetype) { case 'zip': mimeType = MimeType.ZIP break case 'svg': mimeType = MimeType.SVG break case 'rtf': mimeType = MimeType.RTF break case 'png': mimeType = MimeType.PNG break case 'txt': mimeType = MimeType.PLAIN_TEXT break case 'pdf': mimeType = MimeType.PDF break case 'opendoc_text': mimeType = MimeType.OPENDOCUMENT_TEXT break case 'opendoc_spreadsheet': mimeType = MimeType.OPENDOCUMENT_SPREADSHEET break case 'opendoc_presentation': mimeType = MimeType.OPENDOCUMENT_PRESENTATION break case 'opendoc_graphics': mimeType = MimeType.OPENDOCUMENT_GRAPHICS break case 'word_legacy': mimeType = MimeType.MICROSOFT_WORD_LEGACY break case 'word': mimeType = MimeType.MICROSOFT_WORD break case 'powerpoint_legacy': mimeType = MimeType.MICROSOFT_POWERPOINT_LEGACY break case 'powerpoint': mimeType = MimeType.MICROSOFT_POWERPOINT break case 'excel_legacy': mimeType = MimeType.MICROSOFT_EXCEL_LEGACY break case 'excel': mimeType = MimeType.MICROSOFT_EXCEL break case 'jpeg': mimeType = MimeType.JPEG break case 'javascript': mimeType = MimeType.JAVASCRIPT break case 'html': mimeType = MimeType.HTML break case 'slides': case 'slide': mimeType = MimeType.GOOGLE_SLIDES break case 'spreadsheet': case 'spreadsheets': mimeType = MimeType.GOOGLE_SHEETS break case 'forms': case 'form': mimeType = MimeType.GOOGLE_FORMS break case 'drawings': case 'drawing': mimeType = MimeType.GOOGLE_DRAWINGS break case 'docs': case 'doc': mimeType = MimeType.GOOGLE_DOCS break case 'script': mimeType = MimeType.GOOGLE_APPS_SCRIPT break case 'gif': mimeType = MimeType.GIF break case 'directory': mimeType = MimeType.FOLDER break case 'folder': mimeType = MimeType.FOLDER break case 'csv': mimeType = MimeType.CSV break case 'css': mimeType = MimeType.CSS break case 'bmp': mimeType = MimeType.BMP break default: mimeType = null; break } return mimeType; }