Upload images in Laravel (video tutorial)
Last updated: Dec-12-2025
Overview
Learn how to upload images in a Laravel application using the community-developed Cloudinary Laravel SDK. This tutorial demonstrates how to use Laravel with Livewire to create a product form that uploads images to Cloudinary using the storeOnCloudinary method, then retrieves and displays those assets to users.
The Cloudinary Laravel SDK provides easy ways to abstract file uploads, giving you access to features like optimization, transformations, and AI analysis out of the box.
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.
Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
Introduction
| As a web developer, handling media and assets is a crucial part of an application's infrastructure. Cloudinary provides an easy way to store images, videos, and other files, giving you features like image optimization, AI analysis, and generative fill out of the box. |
Laravel Cloudinary SDK features
| The community-developed Cloudinary Laravel SDK provides ways of abstracting how you upload files through Laravel into Cloudinary. It also gives you easy ways of using Laravel's facades to upload images and retrieve those files later. |
The storeOnCloudinary method
This tutorial focuses on the storeOnCloudinary method helper provided by the Laravel Cloudinary SDK. You'll use Laravel and Livewire to create a form that uploads a file to Cloudinary so you can later retrieve and display it on the page. |
Setting up the product form
| Create a dashboard view with a product form that allows users to add a product name, description, price, and upload an image. Currently, the form stores images to a local public folder, but you'll connect it to Cloudinary instead. |
Database structure
The products table includes image_url and image_public_id columns. These fields store the Cloudinary URL and public ID, which you'll use to retrieve and display images with transformations later. |
Uploading to Cloudinary
Use the storeOnCloudinary method to upload files directly to Cloudinary. Specify a folder (like "products") to organize your assets. The SDK handles the upload process, making it easy to integrate Cloudinary into your Laravel application. |
Retrieving image data from the SDK
| The Laravel Cloudinary SDK provides methods to retrieve the secure URL and public ID of uploaded images. Store these values in your database for later retrieval, allowing you to display optimized images to your users. |
Testing the upload form
| Test the form by uploading an image. Notice the loading indicator while the image uploads to Cloudinary. Using Laravel Livewire, you can show a skeleton loader while waiting for the upload to complete, providing a smooth user experience. |
Keep learning
- Learn more about the community-developed Laravel SDK and its features.
- Explore our community-developed libraries for other frameworks.
- Explore other ways to upload assets programmatically.
- Watch more Dev Hints videos on the Cloudinary YouTube channel.
If you like this, you might also like...
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.
