carrierwave
https://github.com/jnicklas/carrierwave
Ruby
Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks
CarrierWave::Uploader::ContentTypeBlacklist#content_type_blacklist
Override this method in your uploader to provide a blacklist of files content types which are not allowed to be uploaded. Not only strings but Regexp are allowed as well. === Returns [NilClass, String, Regexp, Array[String, Regexp]] a blacklist of content types which are not allowed to be uploaded === Examples def content_type_blacklist %w(text/json application/json) end Basically the same, but using a Regexp: def content_type_blacklist [/(text|application)\/json/] end
Edit
git clone [email protected]:jnicklas/carrierwave.git
cd carrierwave
open lib/carrierwave/uploader/content_type_blacklist.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-CarrierWave--Uploader--ContentTypeBlacklist-content_type_blacklist-for-pr
# Commit to gitgit add lib/carrierwave/uploader/content_type_blacklist.rbgit commit -m "better docs for CarrierWave::Uploader::ContentTypeBlacklist#content_type_blacklist"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-CarrierWave--Uploader--ContentTypeBlacklist-content_type_blacklist-for-pr
hub pull-request
# Celebrate!