Sha256: ab55d78e040ac936d2c520c37f05b2b6e3cf21df3a6eb0525275b088ebf330a4

Contents?: true

Size: 1.81 KB

Versions: 17

Compression:

Stored size: 1.81 KB

Contents

module Fog
  module Storage
    class AWS
      class Real

        # Get a hash of hidden fields for form uploading to S3, in the form {:field_name => :field_value}
        # Form should look like: <form action="http://#{bucket_name}.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
        # These hidden fields should then appear, followed by a field named 'file' which is either a textarea or file input.
        #
        # ==== Parameters
        # * options<~Hash>:
        #   * acl<~String> - access control list, in ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
        #   * Cache-Control - same as REST header
        #   * Content-Type - same as REST header
        #   * Content-Disposition - same as REST header
        #   * Content-Encoding - same as REST header
        #   * Expires - same as REST header
        #   * key - key for object, set to '${filename}' to use filename provided by user
        #   * policy - security policy for upload
        #   * success_action_redirect - url to redirct to upon success
        #   * success_action_status - status code to return on success, in [200, 201, 204]
        #   * x-amz-security-token - devpay security token
        #   * x-amz-meta-... - meta data tags
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html

        def post_object_hidden_fields(options = {})
          if options['policy']
            options['policy'] = Base64.encode64(Fog::JSON.encode(options['policy'])).gsub("\n", "")
            options['AWSAccessKeyId'] = @aws_access_key_id
            options['Signature'] = Base64.encode64(@hmac.sign(options['policy'])).gsub("\n", "")
          end
          options
        end

      end
    end
  end
end

Version data entries

17 entries across 17 versions & 8 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-nirvanix-1.8.1 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-parser-fix-1.6.1 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-test-again-1.6.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-parser-fix-1.6.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-sgonyea-1.8.1 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-1.8.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-1.7.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-1.6.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
fog-1.5.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb
rackspace-fog-1.4.2 lib/rackspace-fog/aws/requests/storage/post_object_hidden_fields.rb
fog-1.4.0 lib/fog/aws/requests/storage/post_object_hidden_fields.rb