- Node.js (v18 or later)
- npm or yarn
- Git
git clone https://github.com/AYANscyy2/uploadToCloudinary
cd upload-to-cloudinary
npm install
# or
yarn install
-
Create a Cloudinary Account
- Go to Cloudinary
- Sign up for a free account
- Navigate to your Dashboard
-
Retrieve Cloudinary Credentials
- Cloud Name: Found in the top section of your dashboard
- API Key: Located in the Account Details section
- API Secret: Also in the Account Details section
- Upload Preset: Create this in your Cloudinary Media Library settings
-
Create Environment Files Create two files in the project root:
.env.local
(for development).env.production
(for production)
Add the following to both files:
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=<next_public_cloudinary_cloud_name>
NEXT_PUBLIC_CLOUDINARY_API_KEY=<next_public_cloudinary_api_key>
CLOUDINARY_API_SECRET=<cloudinary_api_secret>
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=<upload_preset>
- Create an Environment Sample File
cp .env.local .env.local.sample
cp .env.production .env.production.sample
Important: Modify the .env.sample
files to remove actual credentials, leaving only the key names.
Ensure your .gitignore
includes:
# Environment Variables
.env.local
.env.production
npm run dev
# or
yarn dev
Open http://localhost:3000 in your browser.
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
: Used for client-side referencesNEXT_PUBLIC_CLOUDINARY_API_KEY
: Public API key for client-side operationsCLOUDINARY_API_SECRET
: Secure API secret for server-side operationsNEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET
: Preset for upload configurations
- Log in to your Cloudinary Console
- Go to Settings > Upload
- Scroll to Upload Presets section
- Click "Add upload preset"
- Configure your desired upload settings
- Copy the preset name to use in your
.env
file
- Set environment variables in your hosting platform
- Run build command:
npm run build
# or
yarn build
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Ensure all dependencies are installed
- Check that environment variables are correctly set
- Verify Cloudinary credentials and upload preset