Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Brad Murray's Profile

GitHub User: wyaeld

Site: b

Comments by Brad Murray

Avatar

The SVN blog discusses that. The short answer is you can't use conditionals that can change when the template itself doesn't. Impacts system design a bit.

Avatar

There is a missing step here, and in the example code.

When uploading images to S3, you want to specify the Content-Type, otherwise S3 will just default it to "application/octet-stream", which can cause your browser to throw warnings when you retrieve the file.

This caught me out, because Content-Type is listed in the multi-part form request as a component of the "file" input, however crucially S3 will NOT look at that. You need to pass it again.

In my case, using jqueryFileUpload as Ryan did, I have

<input id="content-type" name="Content-Type" type="hidden" value="" />

and

add: (e,data)
  ...
  data.form.find('#content-type').val(file.type)
  data.submit()