How does file upload work?
(Resolved)When i upload a file prisma tells me that the type of the file is json while type string is expected
7 Replies
Prisma is just an ORM. Only the data related to those files is saved in the database, such as path, name, etc. The file itself has to be saved in fs or some cloud. Multer is a popular middleware in Node for file management.
what's the code that is needed for me to have file upload and how can i integrate to wasp?
Read the multer documentation for file management in node
Sorry, but if you are new to web development, this framework may not be highly recommended. It takes care of a lot of work, but first it's important to understand the basics of how its components work. There is a lot of documentation on the web about handling files with react and node.
Uploading files in Wasp works like in any other Node.js + React project. @martinsos wrote a bit here: https://ptb.discord.com/channels/686873244791210014/1062935979951923280/1063085543421907004
Here's a gist with a simple setup with Multer https://gist.github.com/infomiho/ec379df4e33f3ae3410a251ba3aa81af
Gist
Uploading files with Wasp 0.11.8
Uploading files with Wasp 0.11.8. GitHub Gist: instantly share code, notes, and snippets.
Thanks a lot!
Thanks @rirusta for help here!