Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

tquill's Profile

GitHub User: tquill

Comments by

Avatar

I figured it out.

First, change the target for your form (leave the "post" though).

<div id="upload_form">

  <%= s3_uploader_form post: user_url(@user), as: "user[avatar]" do %>
    <%= file_field_tag :file, multiple: false %>
  <% end %>

  <script id="template-upload" type="text/x-tmpl">
    <div class="upload">
      {%=o.name%}
      <div class="progress"><div class="bar" style="width: 0%"></div></div>
    </div>
  </script>

</div>

In the javascript file (I converted it from coffee script) change this line in the done callback:

$.post(to, content);

to

jQuery.ajax({
  type: "PUT",
  url: to,
  data: content
});
Avatar

Did you ever figure this out? I'm looking to do the same thing.