Managing media uploads manually can be a pain โ especially when you're dealing with hundreds of images and videos. Whether you're a content creator, developer, or business owner, storing media in the cloud should be fast, organized, and reliable.
That's where Cloudinary Uploader comes in.
Built with Node.js, this open-source tool automates the process of uploading images and videos from a local folder to Cloudinary. It supports batch processing, multi-format handling, retry logic, and more.
Letโs dive into how it works and how you can get started in minutes.
๐ Why Use This Uploader?
Hereโs what makes Cloudinary Uploader stand out:
- ๐ Bulk Upload: Upload dozens or even hundreds of media files in one go.
- โ๏ธ Cloud Storage: Securely store media on Cloudinary.
- ๐ง Smart Detection: Automatically detects and separates images from videos.
- ๐ฆ Batch Processing: Upload files in customizable batch sizes.
- โป๏ธ Retry Mechanism: Automatically retries failed uploads.
- ๐ Detailed Summary: Get a clear report of success and failure rates.
โ๏ธ Features at a Glance
Feature | Description |
---|---|
Supported Formats | Images: PNG, JPG, GIF, SVG, WebP, etc. Videos: MP4, AVI, MOV, etc. |
Organized Uploads | Uploads are organized into images/ and videos/ folders in Cloudinary |
Retry Logic | Configurable retry attempts for failed uploads |
Batch Configuration | Upload files in batches (default: 10 per batch) |
CLI Monitoring | Real-time progress updates in the terminal |
๐ Project Structure
cloudinary-uploader/
โโโ images/ # Place your media files here
โโโ index.js # Main script
โโโ .env # Your Cloudinary credentials (not committed)
โโโ .env.example # Example for setting up your env file
โโโ package.json # Project metadata and dependencies
โโโ README.md # Project documentation
๐ Getting Started
1. Clone the Repository
git clone https://github.com/manthanank/cloudinary-uploader.git
cd cloudinary-uploader
2. Install Dependencies
npm install
3. Configure Environment Variables
Create a .env
file based on the provided .env.example
:
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
Find these credentials in your Cloudinary dashboard.
๐ผ๏ธ Uploading Media
- Place all your images and videos inside the
images/
folder. - Run the uploader:
npm start
Youโll see real-time logs like:
๐ Found 150 media files to upload
๐ผ๏ธ Images: 120
๐ฅ Videos: 30
โ๏ธ Processing in batches of 10 files
๐ Retry attempts: 3
...
๐ฅ Uploaded video1.mp4 (video): https://res.cloudinary.com/demo/video/upload/videos/video1.mp4
๐ ๏ธ Customization Options
๐ Batch Size & Retry Attempts
You can adjust these in index.js
:
const BATCH_SIZE = 10; // Upload 10 files per batch
const RETRY_ATTEMPTS = 3; // Retry failed uploads 3 times
const RETRY_DELAY = 2000; // Delay between retries (in ms)
โ Add More File Types
To support additional formats, modify the extension arrays:
const IMAGE_EXTENSIONS = [...];
const VIDEO_EXTENSIONS = [...];
๐งช Error Handling & Troubleshooting
Problem | Solution |
---|---|
โ Folder not found | Ensure images/ exists |
โ Invalid credentials | Check your .env file |
โ Upload failed | Check file format, size, internet connection |
โ Resource type error | Verify correct file extension |
๐ Upload Summary
At the end of each run, youโll see a detailed summary:
๐ Upload Summary:
๐ผ๏ธ Images - โ
Successful: 118, โ Failed: 2
๐ฅ Videos - โ
Successful: 30, โ Failed: 0
๐ Overall Success Rate: 98.7%
๐ Security Best Practices
- Never commit your
.env
file to version control - Store your credentials securely (e.g., use CI/CD secrets in production)
- Cloudinary uses secure URLs by default for all media
๐ฆ Tech Stack
- Node.js: Core runtime
- Cloudinary SDK: Media upload API
- dotenv: Load environment variables
- fs & path: File system utilities
๐งโ๐ป Contributing
Want to improve this project?
- Fork the repo
- Create a new feature branch
- Commit and push your changes
- Submit a pull request ๐
๐ Final Thoughts
If you're tired of dragging and dropping files into a web dashboard, Cloudinary Uploader offers a powerful alternative. With just one command, you can upload hundreds of images and videos into organized Cloudinary folders โ complete with progress tracking and error handling.
Give it a try and streamline your media management today.
๐ GitHub Repository: manthanank/cloudinary-uploader
๐งโ๐ป Author: Manthan Ankolekar