This is an example application that demonstrates how to upload images to Cloudinary using Node.js, Express, and Multer.
Before running the application, make sure you have the following installed:
- Node.js
- npm (Node Package Manager)
- Cloudinary account (sign up at https://cloudinary.com/ if you don't have one)
- Clone the repository:
git clone https://github.com/banx9x/upload-to-cloudinary-example.git
cd upload-to-cloudinary-example
- Install the dependencies:
npm install
-
Set up Cloudinary credentials:
-
Create a
.env
file in the root of the project. -
Add the following lines to the
.env
file:CLOUDINARY_URL=YOUR_CLOUDINARY_URL
-
Replace
YOUR_CLOUDINARY_URL
with your actual Cloudinary credentials. You can find these credentials in your Cloudinary account dashboard.
-
-
Start the application:
npm run dev
-
Open your web browser and navigate to
http://localhost:8080
. -
Use Postman to upload an image file. The uploaded image will be stored in your Cloudinary account.
- The application uses the Multer middleware for handling file uploads.
- Uploaded images are stored in memory using Multer's
memoryStorage
and then uploaded to Cloudinary using the cloudinary package. - The uploaded image URL is returned after successful upload.
This project is licensed under the MIT License.