GithubHelp home page GithubHelp logo

eddturtle / direct-upload-s3-signaturev4 Goto Github PK

View Code? Open in Web Editor NEW
50.0 50.0 13.0 49 KB

Example of Directly uploading files to S3 with PHP

License: MIT License

PHP 88.19% CSS 11.81%
aws example php s3 upload

direct-upload-s3-signaturev4's Introduction

Edd Turtle โ€” @eddturtle

I'm a PHP and Go developer, specialising in building scalable web apps. Currently working at Hoowla, a prop-tech company in the UK. I enjoy blogging about my experiences, mostly about creating and coding new things.

Likes = ๐Ÿšฒ ๐ŸŒ โ›บ ๐ŸŒณ

Get in touch

direct-upload-s3-signaturev4's People

Contributors

eddturtle avatar prestiget avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

direct-upload-s3-signaturev4's Issues

Response for preflight has invalid HTTP status code 403

Hi everyone. I'm getting two errors in the Chrome console when I try running the simple example on my php server:

  1. OPTIONS http://bucket.region.amazonaws.com/ (it's "red" with little other information)
  2. XMLHttpRequest cannot load http://bucket.region.amazonaws.com/. Response for preflight has invalid HTTP status code 403

How do I fix this? I've got a file called cors in the root of my bucket with the following:

<CORSConfiguration>
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>

    </CORSRule>
</CORSConfiguration>

Any idea what I'm missing?

Thanks!

Handling AWS upload response encoding quirk when uploading to folders

The AWS post xml response in the Location field has / encoded as %2F. It doesn't seem to be the uploader issue (things in Chrome Debug Console look like filename is sent not urlencoded).

I'm suggesting to change this line here to include a .replace("%2F", "/").

It's worth noting that the Key response comes back with a '/' and not with '%2F' as is the case with Location, so the issue is most likely with S3 and not the provided html.

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.