This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// * we need a slice of JavaScript that the client will invoke to | |
// * send a post request to the signed url with the signed form data | |
// the name S3 matches what we declared in our SimpleS3Upload module | |
let Uploaders = {}; | |
Uploaders.S3 = function (entries, onViewError) { | |
entries.forEach((entry) => { | |
// Prepares an AJAX request | |
let xhr = new XMLHttpRequest(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule SimpleS3Upload do | |
@moduledoc """ | |
Dependency-free S3 Form Upload using HTTP POST sigv4 | |
https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html | |
""" | |
@doc """ | |
Signs a form upload. | |
The configuration is a map which must contain the following keys: | |
config = %{ |