Open mmc1ntyre opened 11 years ago
It's most likely a configuration bug. Double check your CORS policy on the S3 server. The declared server must match the one you are using.
I went through the Railscasts tutorial again and added a coffee script file "similar" to the one at ....
Once I did this it worked. I'm not sure if gem was supposed to have this baked in or the documentation needs updating.
The Content-Type hidden field isn't being included in your form most likely. Did you use the form helper this gem provides or the one in the railscast?
Thanks for everyone's help...the issue is fixed
I'm having this problem. How do I get this fix?
your getting this error? Invalid according to Policy: Policy Condition failed: ["starts-with", "$Content-Type", ""]
Yes
Putting this into form resolves the error:
hidden_field_tag "Content-type", ""
I have not found yet the reason why my S3 bucket expects this field. Apparently this demo works without this field: https://github.com/pjambet/direct-upload
i am also seeing this
I am also having this problem. The funky thing is that it was working fine.
Make sure you use the correct helper method in your view, something like:
<%= s3_uploader_form callback_url: model_url, callback_param: "model[image_url]", id: "myS3Uploader" do %>
<%= file_field_tag :file, multiple: true %>
<% end %>
Are you doing this?
Yes but without the callbacks
<%= s3_uploader_form id: "myS3Uploader" do %>
<%= file_field_tag :file, multiple: true %>
<% end %>
When you look at the HTML this helper method generates the form tag should look like this:
<form accept-charset="UTF-8" action="https://s3.amazonaws.com/bucket-name" data-callback-method="POST" data-callback-param="file" data-callback-url="null" enctype="multipart/form-data" id="s3uploaderz" method="post">
...
</form>
Does yours? It seems that for some reason some browsers are not sending the content-type header when posting the form, I'm trying to track down why. In the mean time you can just add the hidden field like @danvelduck did like so:
<%= s3_uploader_form id: "myS3Uploader" do %>
<%= hidden_field_tag "Content-Type", "" %>
<%= file_field_tag :file, multiple: true %>
<% end %>
sorry, it was my problem ... in my assets I had a a different version of the "jquery.fileupload.js" ... I just remove that and now is working.
I think the problem was that this line https://github.com/waynehoover/s3_direct_upload/blob/master/app/assets/javascripts/s3_direct_upload.js.coffee#L90
was not doing its job.
Thanks, for your help
I'm having the same issue. I followed the readme to set up. One difference is that I am loading my form via an ajax request, so I'm doing my $("#s3-uploader").S3Uploader();
in the new.js.erb for my image model instead of doing it in my application script (which seems to be working ok). I've added the hidden input field as suggested and also revised my CORS to match the example in the readme. Any ideas what else I could try or what kind of information would help find the issue?
Thanks for your help
I had the same issue, I was able to fix it by adding ()
to the S3Uploader function call
jQuery("#fileS3Uploader").S3Uploader()
instead of
jQuery("#fileS3Uploader").S3Uploader
Any ideas why this would be happening?
AccessDenied