Rails API upload image with refile and s3 using json
<p>I need to upload image to <code>s3</code> using <code>refile</code> gem with <code>Rails-API</code> via. <code>json</code> I follow refile guide on how to setup refile with S3 and when I test it with curl the POST request get created successfully but the image did not upload.</p>

<p><em>Request json data:</em></p>

<pre><code>{
  "picture": {
    "image":"@bin/test.jpg;type=image/jpeg",
    "imageable_id":"1",
    "imageable_type":"Product"
  }
}
</code></pre>

<p><em>Curl request:</em></p>

<pre><code># curl_post file
create() {
  curl -v -X POST \
     -H 'Accept: application/json' \
     -H "Content-Type: application/json" \
     -d @bin/product.json \
     http://localhost:3000/api/pictures
}

$1
</code></pre>

<p><em>The console log:</em></p>

<pre><code>Started POST "/api/pictures" for 127.0.0.1 at 2016-02-26 23:04:03 +0200
Processing by Api::PicturesController#create as JSON
  Parameters: {"picture"=&gt;{"image"=&gt;"@bin/test.jpg;type=image/jpeg", "imageable_id"=&gt;"1", "imageable_type"=&gt;"Product"}}
   (0.2ms)  BEGIN
  SQL (0.4ms)  INSERT INTO "pictures" ("image_id", "imageable_type", "imageable_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["image_id", nil], ["imageable_type", "Product"], ["imageable_id", 1], ["created_at", "2016-02-26 21:04:03.444481"], ["updated_at", "2016-02-26 21:04:03.444481"]]
   (33.3ms)  COMMIT
Completed 201 Created in 39ms (Views: 0.7ms | ActiveRecord: 34.0ms)
</code></pre>