How to Upload Images
This guide will walk you through the process of uploading images to Cloudinary.
This is a two-step process that involves signing the request and then uploading the image.
-
Generate a new random UUID for the image.
-
Make a request to the Sign Cloudinary Request API to request a Cloudinary upload signature. Pass the UUID as the
public_id
parameter and set theupload_preset
parameter to eitherfeatured-company-logo
orfeatured-company-full
depending on the type of image you are uploading. -
Compile request data.
const formData = new FormData();formData.append("file", file); // The file to uploadformData.append("upload_preset", preset);formData.append("public_id", uuid);formData.append("api_key", apiKeyId); // From the sign requestformData.append("timestamp", timestamp); // From the sign requestformData.append("signature", signature); // From the sign request -
Make the request.
await axios.put("https://api.cloudinary.com/v1_1/drimvo8rp/image/upload",formData, // From the previous step{headers: {"Content-Type": "multipart/form-data",},method: "POST"});
You can access these images using the Cloudinary URL format:
https://res.cloudinary.com/drimvo8rp/image/upload/t_{upload_preset}/v1674796880/{folder}/{uuid}
folder
The folder is either featured-company-logo
or featured-company
depending on the type of image you are uploading.