From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Add image upload

Add image upload

So now we want to add the images field, which is going to look like this. And if we choose a file, an image, and we can choose multiple images, and click Open, you'll see the little spinner. And then it will show the image here. And you can keep choosing images if you want. So to do that, we're going to be using the Upload Button component that was exported from this file right here. So we want to bring this into our form. Now before we do that, one thing we have to do is in the validators TS, in the insert product schema, remember we commented these three fields out because we weren't using them. Now we're going to use images, so I'm going to uncomment that. And then we're going to open up the form, which is components admin product form. And we want to import here. We want to import the upload button. So let's say upload button. Now there's a couple options. you want to choose the at slash lib slash upload thing, where we exported it from. Then we want to go down right above the…

Contents