Programmable Media

Upload images in Hono (video tutorial)

Last updated: Feb-19-2025

Overview

Learn how to upload images to Cloudinary within a Hono application.

Video tutorial


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

Tutorial contents

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

Introduction to Hono and Cloudinary

Jump to this spot in the video  0:00 Using Hono and Cloudinary together can give you a fast and secure way to upload assets at scale via an API.

Set up the upload route

Jump to this spot in the video  0:15 Start in a Hono application and use middleware to set up your Cloudinary configuration. Then create a route for uploading an image:

Upload an image

Jump to this spot in the video  1:02 Define the image as a file, then turn it into a byte array buffer. Encode it as base64 to upload to Cloudinary using Hono's encodeBase64 function, and use the Node.js SDK upload method to upload the data. Log the result of the upload to the console and return it to the API too.

Test the image upload

Jump to this spot in the video  2:39 Use a multipart form to test the image upload. See the JSON response and click the URL to see the image delivered from Cloudinary. You can also use the upload_stream method from the Node.js SDK.

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: