Last updated: Nov-14-2022
On this page:
Cloudinary's Upload API allows you to quickly upload your images, videos and other media files to Cloudinary for immediate deliverability. Let's show you how to use this API in your development environment.
This video is brought to you by Cloudinary's video player - embed your own!
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
Supported programming languages
|0:11||Our tutorial uses Node.js and server-side scripts to demonstrate the upload capabilities. However, we support many popular programming languages, including Ruby, PHP, Python and more.|
Write your script
|0:32||Start writing a script that uses Cloudinary's Upload API to get the image into your Cloudinary product environment. Our example requires two different libraries - the Cloudinary Node.js SDK and dotenv, which allows your development environment to use your Cloudinary credentials and upload the assets in an authenticated way.|
Retrieve your environment variable
|0:50||Retrieve your environment variable from your Cloudinary Programmable Media Dashboard, then paste it into a .env file in your development project. Do not expose your Cloudinary product environment credentials in your site's frontend and public code.|
Call the Upload API
|1:14||Call the Cloudinary Upload API, then reference the file you want to upload.|
Add callback functions
|1:19||Add your callback functions. This tutorial uses promises to handle the successes and failures in the code.|
Ensure script libraries are installed
|1:26||Make sure all of our script's libraries are properly installed with a simple
Run the script and upload the local asset
|1:41||You should have gotten a successful JSON response with lots of data about the uploaded file, including its resolution, file size, format, and more. The file is also now an immediately deliverable asset from a secure, HTTPS URL.|
Upload an asset from a public URL
|2:00||To upload a file from any public URL, simply enter the full URL of the asset, instead of the local file path.|
Add parameters to the upload call
|2:19||You can edit the file's Public ID, so the asset is named exactly what you want it to be. It is also possible to add tags to the asset, so you can easily find and deliver it later. You can even apply quality analysis features to provide automation, based on the blurriness or overall size of the asset.|
- Download, clone or fork the tutorial's GitHub repository to follow along with the shown steps.
- Refer to the full Upload API reference for all the various parameters you can add to upload calls.
- Enroll in our introductory Cloudinary Academy courses that highlight the Node.js SDK, such as Fundamentals for Developers.
If you like this, you might also like...
Generate Upload SignatureGenerate a timestamp and signature for a signed upload
Get Started with the CLISet up the CLI and get familiar with some basic commands
Upload with the CLIApply background removal to images on upload
Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.