# Paperclip: strange mime type on windows

**URL:** <https://www.ruby-forum.com/t/paperclip-strange-mime-type-on-windows/167409>\
**Category:** Rails\
**Created:** [May 7, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/paperclip-strange-mime-type-on-windows/167409 "2009-05-07T16:11:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![triplem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b19c9b/32.png) [@triplem](https://www.ruby-forum.com/u/triplem)\
**Post date:** [May 7, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/paperclip-strange-mime-type-on-windows/167409/1 "2009-05-07T16:11:32Z")

</div>

When i upload a pdf, validations doesn’t work, only images validation  
works. Avoiding check, file was loaded but with this content type:  
file\_content\_type: “binary/octet-stream”

How can i solve? I’d like to have “application/pdf”

---

<div class="post-metadata">

**Author:** ![triplem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b19c9b/32.png) [@triplem](https://www.ruby-forum.com/u/triplem)\
**Post date:** [May 7, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/paperclip-strange-mime-type-on-windows/167409/2 "2009-05-07T16:46:20Z")

</div>

I partially solved using this plugin to get correct mime from extension:  
[http://code.google.com/p/mimetype-fu/](http://code.google.com/p/mimetype-fu/)

And in my model i added:

validate :validate\_content\_type

protected

def validate\_content\_type  
errors.add(:file, “Format #{File.mime\_type?(file.path)} is  
invalid!”) unless File.mime\_type?(file.path) == “application/pdf”  
end

If somebody want to get better this code will be appreciated  
Thanks in any case
