How to Upload a File to Database using Prisma #11795
-
Hello Developers `model user{ }` |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You'll need a cloud storage e.g "google cloud staorage" to store the uploaded files then you'll update the profilePic field with the uploaded file link.
|
Beta Was this translation helpful? Give feedback.
-
Cloud storage or custom storage. There are different approaches. You could go hardcore and save the file as a base64 string of it, and then render the image on the client. Best approach: Cloud Storage To note; Prisma is not a database, it's an ORM, meaning it handles the connection between you and your database, I've seen some databases support file uploads, but I doubt prisma supports them. (As it primarily works only with Mongo & SQL databases) So quick lesson of good practices: When a user uploads an image, you reference the image name, not the image file itself.
|
Beta Was this translation helpful? Give feedback.
-
Great walkthrough! |
Beta Was this translation helpful? Give feedback.
You'll need a cloud storage e.g "google cloud staorage" to store the uploaded files then you'll update the profilePic field with the uploaded file link.
So you're mostly going to be using something like this instead