Yes I know that paperclip has a validates_attachment_content_type, but I would really like to have it validate_by_file_extension … ie … I have an array of allowed file extensions in my app, and I’d like for paperclip to see if the file about to be uploaded has a file extension in that array, and if not I want it to not even start the upload and kick back an error.
How do I go about doing this.
you can define your own validation methods:
but you can’t easily kick back before the start of the upload from rails, as in most cases by the time your rails controller action method gets called, the file has been streamed and a temp file has been created. You’d need to go higher on the stack to be able to stop things from even starting to upload.