Questions tagged [paperclip-validation]
89 questions
2
votes
2 answers
paperclip 5.1 content-type validation too strict
I need to upload attachments with extension of .txt but evaluate to mime-type "application/octet-stream" by the file command. The file is automatically generated by a piece of equipment and it is not feasible to rename it before uploading. I have…

Colin Wu
- 611
- 7
- 25
2
votes
2 answers
Image has contents that are not what they are reported to be
I am getting the following error while using the paperclip GEM.I have tried uploading JPG/PNG and neither works. It seems like I am getting validation error..any help would be awesome thanks!
Image has contents that are not what they are reported to…

westman2222
- 663
- 1
- 12
- 30
2
votes
2 answers
Paperclip says content type is wrong when using an external URL as attachment
I'm using Paperclip 4.2 + Rails 4.1.6 with the following model:
class Post < ActiveRecord::Base
has_attached_file :featured_image, styles: { :medium => "300x300>", :thumb => "100x100>" }
validates_attachment :featured_image, :content_type => {…

etnlmy
- 21
- 3
2
votes
1 answer
Can I validate that a paperclip attachment is not a dangerous filetype?
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…

Mark Robinson
- 1,479
- 2
- 15
- 34
2
votes
3 answers
custom paperclip validation error message
I have this validation for content type:
validates_attachment_content_type :photo, :content_type => /^image\/(jpg|jpeg|pjpeg|png|x-png|gif)$/, :message => 'file type is not allowed (only jpeg/png/gif images)'
I want only the message above to be…

Jaqx
- 826
- 3
- 14
- 39
2
votes
2 answers
can't upload image (paperclip) and jquery mobile
Can't save avatar(image)
get this message :
1 error prohibited this notice from being saved:
Avatarを入力してください。
development.log
Started PUT "/notices/1" for 127.0.0.1 at 2013-04-11 18:32:59 +0900
Processing by NoticesController#update as…

whitesiroi
- 2,725
- 4
- 30
- 64
1
vote
3 answers
Not recognized by the 'identify' command error while using validates_each
Below is my validations for image content type which works fine.
validates_attachment_size :icon, :less_than => MAX_SIZE.megabytes, :message => "Max size is 1 mb"
validates_attachment_content_type :icon, :content_type => ['image/jpg','image/jpeg',…

ashisrai_
- 6,438
- 2
- 26
- 42
1
vote
0 answers
Paperclip content size validation is not working
I have set up an user management app using paper clip and I want to upload user's aadhar and pan card on his or her profile update. Its working fine but when I upload file which violates the validations, its not showing errors and files are getting…

devi
- 11
- 2
1
vote
2 answers
Not able to upload the different files in paperclip with type application/*
I am using rails 5 with ruby 2.4
gem "paperclip", "~> 5.0.0"
The content type of the file which I am upload is as
@content_type="application/octet-stream" (this is from the terminal), so I have mentioned this content type inside the model…

vidur punj
- 5,019
- 4
- 46
- 65
1
vote
0 answers
Upload file and detect language from the uploaded content / filename with Paperclip for Ruby on Rails
I have some PDF and video files those I want to upload and detect the language of those from the uploaded contents or file names using Paperclip and Ruby on Rails app on the Linux server.
I'm using s3 storage for uploading files with Paperclip as…

Sumit Munot
- 3,748
- 1
- 32
- 51
1
vote
1 answer
Is it possible to upload .mov files using Paperclip?
I've been using Paperclip to save audio and pdf files to Amazon S3. I also need to add support for .mov video files. I don't need to play them in the browser, just save them to S3. Is this possible?
This works for the audio and pdf files -…

ewkruljac
- 17
- 3
1
vote
4 answers
Paperclip validation issue on production
I have a Problem when I deploy my application on google cloud I get this error
has contents that are not what they are reported to be
Locally it works fine! I already tried to using the command_path. So I really don't know what I have to do…

BilalReffas
- 8,132
- 4
- 50
- 71
1
vote
1 answer
Content type validations for fonts using paperclip
I'm trying to upload font files as attachments in paperclip and I get this error.
ActiveRecord::RecordInvalid: Validation failed: File content type is invalid, File is invalid
Here is what I tried
validates_attachment_content_type :file,…

Pamela Guerrero
- 107
- 2
- 11
1
vote
2 answers
Upload code files with paperclip
What should be the validates_attachment_content_type configuration in order to be able to upload code files. In my case I want to upload .R files.
I want to do something like this:
class RFile < ActiveRecord::Base
has_attached_file :r, url:…

Mario
- 1,213
- 2
- 12
- 37
1
vote
1 answer
paperclip doesn't show my custom message
I have a Rails 4 app using Paperclip 4.3.2. I have the following specified in my model:
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/, :message => "some message"
When I try to load a wrong file I hoped to find the…

Rafa
- 11
- 1