Save images from file input in form POST method
So recently I've been learning express JS and wanted to do a simple project of making a website with a form. it will receive a name and an image. Show both after submitting the form.
The problem lies in the file input in the form. I can grab the name of the file but I don't know how to download it and save it in an assets/gallery folder to later show it. Can anyone help? Thanks
Below is the index.js code and also for added context I use hard coded array called gallery to store the data since I wanted to just focus on express and not deal with database for now.
2 Replies
There's a library called Sharp that can help with that, it's pretty well documented and flexible, allows you to also do image manipulation and stuff like that.
Thanks for the reply I'll look into it and hopefully it will solve my problem :D