Skip to content

Shreeja5714/cloudinary-multer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multer & Cloudinary File Upload API

A Node.js Express application for handling file uploads with support for both local storage and Cloudinary cloud storage. Supports single and multiple file uploads.

Features

  • ✅ Single file upload to local storage
  • ✅ Single file upload to Cloudinary
  • ✅ Multiple file uploads to local storage
  • ✅ Multiple file uploads to Cloudinary
  • ✅ MongoDB integration for storing file metadata
  • ✅ Buffer-based file processing

Tech Stack

  • Node.js - Runtime environment
  • Express.js - Web framework
  • Multer - File upload middleware
  • Cloudinary - Cloud storage service
  • MongoDB - Database
  • Mongoose - MongoDB ODM

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (running locally or remote connection)
  • Cloudinary account (Sign up here)

Project Structure

cloudinary-multer/
├── src/
│   ├── models/
│   │   ├── singleLocal.js
│   │   ├── singleCloud.js
│   │   ├── multipleLocal.js
│   │   └── multipleCloud.js
│   └── multer/
│       ├── singleLocal.js
│       ├── singleCloud.js
│       ├── multipleLocal.js
│       ├── multipleCloud.js
│       └── bufferGenerator.js
├── upload/                    # Local file storage
├── routs.js                   # Single upload routes
├── multipleUploadsrouter.js   # Multiple upload routes
├── index.js                   # Main server file
├── .env                       # Environment variables
└── package.json

Testing with Postman

Important: All files must use the same key name files

The server will start on `http://localhost:5000`

## Accessing Uploaded Files

Local files are accessible at:

http://localhost:5000/uploads/


## Environment Variables

| Variable | Description |
|----------|-------------|
| `CLOUD_NAME` | Your Cloudinary cloud name |
| `API_KEY` | Your Cloudinary API key |
| `API_SECRET` | Your Cloudinary API secret |

## Dependencies

```json
{
  "express": "^4.x.x",
  "mongoose": "^7.x.x",
  "multer": "^1.x.x",
  "cloudinary": "^1.x.x",
  "dotenv": "^16.x.x"
}

About

Multer middleware integrated with Cloudinary SDK for seamless image upload and cloud storage

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors