Uploading images to Cloudinary with Multer and NodeJS

◈ 𝐅𝐫𝐨𝐦 𝐋𝐨𝐜𝐚𝐥 𝐒𝐭𝐨𝐫𝐚𝐠𝐞 𝐭𝐨 𝐂𝐥𝐨𝐮𝐝𝐢𝐧𝐚𝐫𝐲 ☁️ Today I built a simple helper function using Multer and Cloudinary that lets to upload image from local machine to cloudinary. File handling simple, clean, and production-ready, no more manual uploads or heavy local storage dependencies. Code Explain: ● Upload files locally with a unique name. ● Automatically push them to Cloudinary for fast and secure hosting. ● Get back a clean secure_url ready to use in my project. #NodeJS #ExpressJS #Cloudinary #JavaScript #Typescript #BackendDevelopment

  • text

Good work. But i would suggest to configure Cloudinary once at app startup using env vars (don't call cloudinary.config per upload). And wrap err handling with try/catch as youre using async func. Also remove file from local after uploading. Thanks.

great and need to handle error and remove file from local after successfully upload

Great script man! It would be useful to explore the best practices for file uploads by setting both the destination directory and the file name.

See more comments

To view or add a comment, sign in

Explore content categories