How I added S3 Image Uploads to my Next.js App (using tRPC)

How I added S3 Image Uploads to my Next.js App (using tRPC)

Web Dev Cody

1 год назад

20,423 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@JanisGrinvalds
@JanisGrinvalds - 20.11.2023 12:39

but with DigitalOcean I have CORS problem. It wont return the Access-Control-Allow-Origin on my PUT request. In your code You don't even send a file format header. I am so pissed - it takes already several days to deal with this problem.

Ответить
@notfadeaway6617
@notfadeaway6617 - 20.08.2023 08:48

nice video. i use gcs but this video explained everything

Ответить
@liempham986
@liempham986 - 18.06.2023 13:23

Can you git this code plz

Ответить
@MisouSup
@MisouSup - 02.05.2023 02:46

🤯🤯 great stuff!

Ответить
@NubeBuster
@NubeBuster - 09.04.2023 13:27

Appreciated

Ответить
@allisfehr
@allisfehr - 27.02.2023 23:59

What exactly is this part of your code doing:

for (const name in data){
formData.append(name, data[name])
}

Ответить
@aliolfat5827
@aliolfat5827 - 24.02.2023 03:09

Right now, you first store a row to your images table and use the ID from that row as your key for s3. I believe with this ordering, if the call to s3 fails you now have an image in your DB table but no image in S3. The correct ordering should be, make call to s3 and once that's successful, store the location or key in the DB

Ответить
@mohammed.haydar
@mohammed.haydar - 09.02.2023 17:59

What if I've multiple files, what approach would I apply?

Ответить
@elfelipe1996
@elfelipe1996 - 29.01.2023 22:18

Hey! Really good video and it was really useful to me. Thank you! Do you still have the code for this ? I couldn't find it in the github repo you have in the description

Ответить
@sailormetz7148
@sailormetz7148 - 26.01.2023 09:27

Thanks for the great video! I'd also appreciate a guide on how to retrieve files and use them in an image component for example. I'm running into permissions issues, and I'm unsure how to tackle them. Do I allow all public access? Can I configure access for only my application? A discussion around this would be very helpful.

Ответить
@petter9078
@petter9078 - 10.01.2023 22:13

Is this available on GitHub?

Ответить
@leeforster9361
@leeforster9361 - 07.12.2022 08:43

Do you have a github link for this project? Would love to give it a read through

Ответить
@ryanquinn1257
@ryanquinn1257 - 27.11.2022 05:35

I swear everytime I need to do something you already got the video here for me to reference.
Thanks for what you do. It's allowed me to skip a lot of boilerplate of the learning process!

Ответить
@luisgonzalez7533
@luisgonzalez7533 - 29.10.2022 05:40

What a great tutorial, super clear and straight to the point. Keep killing it :)

Ответить
@d2vin
@d2vin - 29.08.2022 19:25

would LOVE to see a full tutorial on how you built this. Big fan of using trpc and s3, as well as the folder structure. I'm using create t3-app but that does backend in a nextjs monorepo. i still have some confusion on how you implemented this tho, if you could send a link to the code that would be much appreciated!

Ответить
@DuyTran-ss4lu
@DuyTran-ss4lu - 29.08.2022 12:56

Great

Ответить
@szymon7932
@szymon7932 - 28.08.2022 14:14

Is there a reason why you can't just make a post request to a server, and upload the image to s3 from the server? If it succeds then you save it to db otherwise not. Right now it looks weird to me to return a url to the client and post image from there if you already know the url, then why it isn't done on the server?

Ответить
@Tomas-pm2rm
@Tomas-pm2rm - 25.08.2022 18:41

do you keep the images in database even if the signed url isn't used? Or do you delete the unused ones later?

Ответить
@hectorsum8102
@hectorsum8102 - 20.08.2022 08:44

Thanks for this tutorial, could you make a video about how to setup s3 bucket in the project?

Ответить
@pieter-venter
@pieter-venter - 18.07.2022 09:46

Great video
You should switch to trpc v10 for the next video though. This video will get stale soon

Ответить
@gamma8238
@gamma8238 - 17.07.2022 12:56

God job ! Can you give us the direct link to the github project?

Ответить
@ponderatulify
@ponderatulify - 16.07.2022 01:50

really nice. How did you find all the info? I find the amazon web services dashboard to be a maze of information :D

Ответить
@_parassolanki
@_parassolanki - 15.07.2022 19:20

The main downside i found with s3 pr signed url is that it doesn't give any response data it just gives you status code 200 so if i want to add s3 image url to my db then i have to do it my self which is more annoying..

Ответить
@SeibertSwirl
@SeibertSwirl - 15.07.2022 16:25

Good job babe!!!!

Ответить