title: Rails 5 + Carrierwave Upload images from mobile?
body: <p>I wrote a rails 5 app with an api that a mobile app can call to send over a base64 encoded image to be uploaded to server, using Carrierwave gem.  The endpoint works great when I test it with Postman.  But when I try to upload an image taken with a mobile camera (whether sent directly from the app or through postman), it fails.  Carrierwave just doesn't save the image.  Does anyone have any idea why and what I can do about it?</p>
  
  <p>imageuploader.rb</p>
  
  <pre><code>class ImageUploader &lt; CarrierWave::Uploader::Base
  
    include CarrierWave::MiniMagick
  
    storage :file
  
    def store_dir
      "uploads/#{mounted_as}/#{model.class.to_s.underscore}/#{model.id}"
    end
  
    def scale(width, height)
      process :resize_to_fit =&gt; [width, height]
    end
  
    def extension_whitelist
      %w(jpg jpeg gif png)
    end
  end
  </code></pre>
  
  <p>model.rb</p>
  
  <pre><code>class Log &lt; ApplicationRecord
    belongs_to :user, class_name: 'User', foreign_key: 'user_id'
    belongs_to :reward, class_name: 'Reward', foreign_key: 'reward_id'
  
    mount_base64_uploader :image, ImageUploader
  end
  </code></pre>
  
  <p>controller.rb</p>
  
  <pre><code>class Api::V1::UsersController &lt; Api::V1::BaseController
  
    def log
      @child = User.find(params[:id])
      unless @child.parent_id.nil?
        Log.create(user: @child, reward_id: params[:reward_id], image: params[:image]  )
  
       end
       head :ok
     end
   end
  </code></pre>
  
  <p>end</p>