2

I'm using thoughtbot's paperclip with Rails and want to allow any file type to be uploaded except one that's obviously dangerous. The validates_attachment_content_type method makes it easy to validate that an attachment is of a safe type but is it possible to just validate it's not dangerous?

Mark Robinson
  • 1,479
  • 2
  • 15
  • 34

1 Answers1

2

Yes there is.

validates_attachment :image, :content_type => { :not => "application/zip" }

That would let you use the notion of blacklisting instead of whitelisting.

trh
  • 7,186
  • 2
  • 29
  • 41