Skip to content

Instantly share code, notes, and snippets.

View Deankinyua's full-sized avatar
🎯
Focusing

Dean Kinyua Deankinyua

🎯
Focusing
View GitHub Profile
// * 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();
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 = %{