In rails 4.0.2, I use paperclip gem to upload files. But it does not support the .doc file. An error message is displayed below the file upload field because "it has an extension that does not match its contents"
In the model, validation for checking the type of content is shown below:
validates_attachment_content_type :document, :content_type => ['application/txt', 'text/plain', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.oasis.opendocument.text', 'application/x-vnd.oasis.opendocument.text', 'application/rtf', 'application/x-rtf', 'text/rtf', 'text/richtext', 'application/doc', 'application/docx', 'application/x-soffice', 'application/octet-stream']
Gemstones that are in use right now
rails (4.0.2, 4.0.0, 3.2.13, 3.2.8, 3.0.4, 3.0.3) paperclip (3.5.2, 2.3.11, 2.3.8)
How can I solve this problem?
ruby file validation ruby-on-rails paperclip
shubhra
source share