GithubHelp home page GithubHelp logo

Comments (9)

sshaw avatar sshaw commented on August 30, 2024

Doing exactly what's done in the README's HAML example results in:

🆗, I lied. I did not set success_action_redirect. When I do that, I get:

<Error>
<Code>AccessDenied</Code>
<Message>
Invalid according to Policy: Policy Condition failed: ["eq", "$success_action_redirect", "http://example.com"]
</Message>
<!-- snip -->
</Error>
{
  "expiration": "2019-11-02T05:03:46Z",
  "conditions": [
    [
      "starts-with",
      "$key",
      "sshaw/xxx"
    ],
    {
      "X-Amz-Algorithm": "AWS4-HMAC-SHA256"
    },
    {
      "X-Amz-Credential": "xxx"
    },
    {
      "X-Amz-Date": "20191101T190346Z"
    },
    {
      "bucket": "xxx"
    },
    {
      "acl": "private"
    },
    {
      "success_action_redirect": "http://example.com"
    },
    [
      "content-length-range",
      1,
      5242880
    ]
  ]
}

from carrierwave_direct.

p8 avatar p8 commented on August 30, 2024

Are you calling direct_fog_hash?

User.new.avatar.direct_fog_hash.to_json

It's could use some documentation in the README.md

from carrierwave_direct.

sshaw avatar sshaw commented on August 30, 2024

Are you calling direct_fog_hash?

No. I'm doing what's in the documentation, which calls @uploader.policy.

User.new.avatar.direct_fog_hash.to_json

This just returns a Hash of values, most of which are already used in the HTML form. Not sure of the significance here.

from carrierwave_direct.

p8 avatar p8 commented on August 30, 2024

hmm strange, It shouldn't post json. Could you post some code?

from carrierwave_direct.

sshaw avatar sshaw commented on August 30, 2024

hmm strange, It shouldn't post json. Could you post some code?

@p8, let me quote myself here:

Doing exactly what's done in the README's HAML example...

When you do what's given there, does it work for you?

from carrierwave_direct.

p8 avatar p8 commented on August 30, 2024

I'm using the Rails example which works for me.
The haml example should probably be something like:

%form{:action => @uploader.direct_fog_url, :method => "post", :enctype => "multipart/form-data"}
  - @object.direct_fog_hash.each do |key, value|
    - if key != :uri
      %input{:type => "hidden", :name => key, :value => value}
  %input{:type => "hidden", :name => "success_action_redirect", :value => @uploader.success_action_redirect}
  %input{:name => "file", :type => "file"}
  %input{:type => "submit", :value => "Upload to S3"}

from carrierwave_direct.

sshaw avatar sshaw commented on August 30, 2024

Thanks @p8, that works!

from carrierwave_direct.

p8 avatar p8 commented on August 30, 2024

Great! I'll change the README example

from carrierwave_direct.

sshaw avatar sshaw commented on August 30, 2024

So it appears the only difference between the old example and the new example is redirect URL was not included.

from carrierwave_direct.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.