androidruby-on-railspaperclipmobile-browserpaperclip-validation

Rails Paperclip image upload not working on mobile


I'm creating a site that allows users to upload images from their mobile phones, through their browser. Before adding this feature to my site, I'm testing it out with a rails scaffold. To accomplish image upload, I'm using Paperclip 4.1. Image uploading is working flawlessly on my laptop, but it isn't working on my Android. When I click "Choose file" on my droid, I am able to select an image from my galley (among many other options), but when I click "Update" I get two errors:

Avatar content type is invalid
Avatar is invalid

The content type is a jpg, which I know is valid because I can upload jpgs on my laptop. I don't understand what the other error means. Here is the validation I'm using (got it from paperclip's quick start guide on GitHub):

validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/

Is this a flaw of paperclip, or am I doing something wrong? Please let me know if you need more of my code.


Solution

  • I ended up using CarrierWave instead, which was able to handle image uploads through mobile and desktop.