Paperclip: strange mime type on windows


#1

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”


#2

I partially solved using this plugin to get correct mime from extension:
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