I'm using paperclip to upload image in my app. The validation I've is :
validates_attachment_content_type :image, :content_type => ['image/jpg','image/jpeg', 'image/png', 'image/tiff', 'image/gif']
Everything works well in firefox, chorme and IE9. But in IE8, I get an error - "Photos image content type Invalid format !!!"
Any solution or clue is much appreciated.
says it needs extra image format image/pjpeg
in content type i.e. :content_type => ['image/pjpeg']
Below will be helpful for sure.
http://blog.joshsoftware.com/2010/11/26/paperclip-validates_attachment_content_type-always-fails-in-ie-6-and-7-for-jepg-and-png-image/
http://blog.siyelo.com/tip-of-the-day-mime-types-for-paperclip-ie8
You can try this instead: content_type => /image/
I think you may have misunderstood the previous answer. What he was suggesting was that you use a regular expression on containing the word 'image' instead of adding the forward slash in the front. So your modified code would look like this:
validates_attachment_content_type :image, :content_type => /image/
The // means you are using a regular expression for the content type instead of being explicit by each element in the array. The above would search the whole content_type string and match image, or you can be a little more strict and use:
validates_attachment_content_type :image, :content_type => /^image/
which means that the string has to begin with the word 'image', which it should. This should help you through IE as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With