Return to Snippet

Revision: 67803
at November 1, 2014 18:06 by slvakumr


Updated Code
// 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;
}

Revision: 67802
at October 30, 2014 19:58 by slvakumr


Updated Code
// Mime types defined by Google.
// Author : Selva Kumar
// Blog : slvakumr.com
// Date : 30 Octber 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;
}

Revision: 67801
at October 30, 2014 19:56 by slvakumr


Updated Code
// Mime types defined by Google.
// Author : Selva Kumar
// Blog : slvakumr.com

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;
}

Revision: 67800
at October 30, 2014 18:32 by slvakumr


Initial Code
// Mime types defined by Google.
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;
}

Initial URL

                                

Initial Description
Returns the Mime Types of documents used by google

Initial Title
Google Mime Types

Initial Tags
google, script

Initial Language
C++