Image & Video APIs

Upload images in Go (video tutorial)

Last updated: Sep-04-2025

Overview

Learn how to upload images in Go using the Cloudinary Go SDK.

Video tutorial


This video is brought to you by Cloudinary's video player - embed your own!

View the code
You can find the code from this tutorial in GitHub.

Tutorial contents

This tutorial presents the following topics. Click a timestamp to jump to that part of the video.

Introduction

Jump to this spot in the video  0:00 One of the most important parts of your workflow is getting your images and videos into the Cloudinary Media Library. In this tutorial, you'll learn how to use the Go SDK to upload one or multiple images to Cloudinary.

Upload a single image from your local file system

Jump to this spot in the video  0:17 Once the Cloudinary Go module is installed, imported, and configured, you can upload local images from your directory. Start by creating a context with context.Background() and save it to the variable ctx. Then call the Cloudinary uploader method, passing the image path as an argument. Make sure to reference the correct path in your file system. Save the upload response in a variable and add proper error handling. Finally, print out the response as formatted JSON for easy reading.

Upload response

Jump to this spot in the video  0:51 When you run the script, it returns a comprehensive upload response containing metadata and the delivery URL for your image. You can then open the image in a browser window to verify it's delivered correctly from Cloudinary.

Upload multiple images from your local file system

Jump to this spot in the video  1:01 To upload multiple files efficiently, first define their file paths in an array, then use a Go loop to iterate over this array. Inside the loop, place the Cloudinary uploader code and replace the static image path with the loop variable that represents the current image path. Be sure to add proper error handling to catch any issues during the upload process. This approach ensures each image in the array gets uploaded successfully. For cleaner output, instead of printing the entire upload response for each image, you can log only the secure URLs.

Upload a single image from a remote URL

Jump to this spot in the video  1:41 While we've covered uploading images from your local directory, Cloudinary's uploader is versatile and accepts images from other sources as well. You can upload images directly from remote URLs, allowing you to pull images from other servers directly into your Cloudinary account. The process is straightforward: simply replace the local image path with a web image URL in your uploader call. When you run the code, it returns the Cloudinary delivery URL for the uploaded image, which you can then open in a browser to verify the successful upload.

Keep learning

Related topics

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

 

Cloudinary Academy

 

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.

 

✔️ Feedback sent!

Rate this page: