Skip to content

Instantly share code, notes, and snippets.

@mjzone
Last active June 24, 2020 17:13
Show Gist options
  • Save mjzone/ce1bb32d2e01713e8e3e94aeaa521d07 to your computer and use it in GitHub Desktop.
Save mjzone/ce1bb32d2e01713e8e3e94aeaa521d07 to your computer and use it in GitHub Desktop.
// Set the "level" attribute value to "protected"
const handleChange = async (e) => {
const file = e.target.files[0];
await Storage.put('picture.jpg', file, {
contentType: 'image/jpg',
level: 'protected'
});
}
// HTML
<input type="file" accept='image/jpg' onChange={(evt) => handleChange(evt)} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment