0
votes

I'm trying to use the jquery file upload plugin in my rails app to upload images, documents, and pdfs. I changed the accepted file types to accept pdfs etc. However, when I click 'Start upload', I get the following error (only with .pdf, .docx, and .doc):

Error emptly file upload result

If I try to upload a .txt, .png, .jpg, or .gif, it works fine. I tried increasing the max file size and also creating a .pdf file with 1 word and still got the same error. I've been searching online, I've mostly seen people suggest using the gd-extension for php, but I have a rails application so is there a rails alternative for gd-extension?

Thanks

1
and I don't think it's a size issue because I just tried uploading a 25MB image and it worked - ggrillone

1 Answers

0
votes

Fixed! For anyone with the same issue this is what I did: This fix is for Paperclip fyi.

So in the model where you have 'has_attached_file', you need to pass an additional attribute here: :whiny => false, so it should look something like:

has_attached_file :asset, 
    :styles => { :thumb => "100x100>" },
    :whiny => false,
    :storage => :s3,
    :s3_credentials => "config/s3.yml",
    :path => ":id/:style/:filename"

":whiny" is set to true by default, and it essentially raises an error if Paperclip cannot process a thumbnail of the uploaded file, and since pdf, doc, etc.. doesn't have a thumbnail the emptyResult error was being raised.

Sources:

Paperclip::NotIdentifiedByImageMagickError when file is not a valid attachment content type

https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip.rb