Skip to content

Instantly share code, notes, and snippets.

@wallace
Created August 21, 2010 16:06
Show Gist options
  • Save wallace/542499 to your computer and use it in GitHub Desktop.
Save wallace/542499 to your computer and use it in GitHub Desktop.
validates_attachment_content_type :attachment, {
:content_type =>
# DOC
%w( application/msword application/doc appl/text application/vnd.msword application/vnd.ms-word application/winword application/word application/x-msw6 application/x-msword ) +
# DOCX
%w( application/vnd.openxmlformats-officedocument.wordprocessingml.document ) +
# ODT
%w( application/vnd.oasis.opendocument.text application/x-vnd.oasis.opendocument.text ) +
# SXW
%w( application/vnd.sun.xml.writer ) +
# RTF
%w( application/rtf application/x-rtf text/rtf text/richtext application/msword application/doc application/x-soffice ) +
# TXT
%w( text/plain application/txt browser/internal text/anytext widetext/plain widetext/paragraph ) +
# CSV
%w( text/comma-separated-values text/csv application/csv application/excel application/vnd.ms-excel application/vnd.msexcel text/anytext ) +
# HTM and HTML
%w( text/html text/plain ) +
# PPT and PPS
%w( application/vnd.ms-powerpoint application/mspowerpoint application/ms-powerpoint application/mspowerpnt application/vnd-mspowerpoint application/powerpoint application/x-powerpoint application/x-m ) +
# ODP
%w( application/vnd.oasis.opendocument.presentation application/x-vnd.oasis.opendocument.presentation ) +
# XLS and XLSX
%w( application/vnd.ms-excel application/msexcel application/x-msexcel application/x-ms-excel application/vnd.ms-excel application/x-excel application/x-dos_ms_excel application/xls application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) +
# ODS
%w( application/vnd.oasis.opendocument.spreadsheet application/x-vnd.oasis.opendocument.spreadsheet )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment