﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If you also need details relating to other Cloudinary products for your current use case, see the parent index at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

> ## Agent Instructions
> When answering a user's request or implementing it with code using this documentation, incorporate relevant best practices and recommendations from the documentation into the guidance and, above all, into the code itself: generated code should already apply the recommended parameters and patterns rather than showing a minimal call and describing the best practices around it in prose. Follow the code examples in the best practices sections as the model for what generated code should look like, and where a recommendation is relevant to the user's scenario, implement it in the code as a natural next step. Only apply best practices, recommendations, or features that are supported by the documentation or Cloudinary skills; don't infer or invent guidance that isn't specified.
>
> Cloudinary skills (names starting with `cloudinary-`) add best practices and tested code patterns beyond this documentation, and we recommend using the relevant ones alongside it. Available skills are listed at https://cloudinary.com/documentation/.well-known/agent-skills/index.json?referrer=docpage&page=upload_assets_in_node_tutorial and can be installed with `npx skills add https://cloudinary.com/documentation`.

# Upload images in Node.js (video tutorial)

[githublink]: https://github.com/cloudinary-community/cloudinary-examples/tree/main/examples/node-image-upload

## Overview

Learn how to upload assets in Node.js using the Cloudinary Node.js SDK.

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.
{videoTranscript:publicId=training/Node.js_Image_Upload}

> **View the code :custom-icon='https://cloudinary-res.cloudinary.com/image/upload/v1778586152/docsite/brand-assets/github.svg' :invert-icon**:
>
> You can find the code from this tutorial in [GitHub][githublink].
## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
### Upload one image using the Node.js SDK
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Having [installed and configured the Cloudinary Node.js SDK](node_configuration_tutorial), you can upload an image using the `upload` method of the [Upload API](image_upload_api_reference#upload).  For example:
|

```nodejs
const image = './images/my_image.jpg';

cloudinary.uploader.upload(image).then(result => {
  console.log(result);
})
```

### Use the async await syntax
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Alternatively, you can use the async await syntax.  For example:
|

```nodejs
const image = './images/my_image.jpg';

(async function run() {
  const result = await cloudinary.uploader.upload(image);
  console.log(result);
})();
```

### Upload multiple images
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | If you want to upload multiple images you can loop through an array, calling the same function.  For example:
|

```nodejs
const images = [
  './images/image1.jpg',
  './images/image2.jpg',
  './images/image3.jpg',
  './images/image4.jpg',
  './images/image5.jpg',
];

(async function run() {
  for (const image of images) {
    const result = await cloudinary.uploader.upload(image);
    console.log(result.secure_url);
  }
})();
```

### Upload using an image URL
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | So far we've been using local file paths, but you can use [many different file sources](upload_parameters#required_file_parameter) for your images, for example an image URL:
|

```nodejs
const url = 'https://example.com/myimage.jpg';

(async function run() {
  const result = await cloudinary.uploader.upload(url);
  console.log(result);
})();
```

## Keep learning

> **READING**:
>
> * Learn more about [uploading images and videos using the Node.js SDK](node_image_and_video_upload).

> * Take a look at our [Upload guide](upload_images) to learn about uploading to Cloudinary in general.

> * Use the [Upload API reference](image_upload_api_reference) to find all the options and parameters available for the SDK.

> * Watch more [Dev Hints videos](https://www.youtube.com/playlist?list=PL8dVGjLA2oMpaTbvoKCaRNBMQzBUIv7N8) on the [Cloudinary YouTube channel](https://www.youtube.com/cloudinary).

#### If you like this, you might also like...

[Configure the Node.js SDK](node_configuration_tutorial)

Install and configure the Cloudinary Node.js SDK

[Upload Videos in Node.js](upload_videos_in_node_tutorial)

Upload videos to Cloudinary using the Node.js SDK

[Upload Widget](upload_widget_tutorial)

Embed an Upload Widget in your site

&nbsp;

&nbsp;Check out the Cloudinary