leerob / nextjs-aws-s3 Goto Github PK
View Code? Open in Web Editor NEWExample Next.js app to upload photos to an S3 bucket.
Example Next.js app to upload photos to an S3 bucket.
What's the best way to make sure that the image uploaded to S3 is set to have a Content-Type
of its image extension?
At the moment, this will upload as binary/octet-stream
, so browsers will not be able to display the image but will try to download instead.
This code no more works with PUT. use POST if you face 400 error
Hi there,
First of all thanks for your example. It's really helpful.
I'm always getting CORS issues for this piece of code:
const upload = await fetch(url, {
method: 'POST',
body: formData,
});
Are there any specific nextJS settings I need to add for this to work?
If i move this piece of code to pages/api
everything works without errors.
However the data gets submitted to my S3 bucket whilst throwing a CORS error.
Any help on this?
Thanks alot!
This works great but when I try to compress the image file using multiple compressing packages which simply turn the image file into another file image but compressed, I get a Bad Request back from S3.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.