Upload Images Directly to S3 from Front End


This video is part of the following playlists:


Learn how to store your web app's image files in an s3 bucket by uploading them directly to the bucket. This technique is especially useful in serverless environemnts like when you're using lambda functions or a Next.js application.

There is a different version of this tutorial that I suggest you check out too:

Code:

https://github.com/Sam-Meech-Ward/s3-direct-upload

import express from 'express'
import { generateUploadURL } from './s3.js'

const app = express()

app.use(express.static('front'))

app.get('/s3Url', async (req, res) => {
  const url = await generateUploadURL()
  res.send({url})
})

app.listen(8080, () => console.log("listening on port 8080"))

Find an issue with this page? Fix it on GitHub