> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload images in Flutter (video tutorial)

## Overview

Learn how to upload assets from your Flutter app to Cloudinary and then seamlessly deliver those images from the Cloudinary platform.

## 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
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=00 :player=cld} | After [installing and configuring the Cloudinary Flutter SDK](flutter_configuration_tutorial), you can upload images from your Flutter application to Cloudinary. This process involves using the `upload` method of the [Upload API](image_upload_api_reference#upload), along with an upload preset that specifies the upload behavior. The images you upload will be displayed in the Media Library.
|

### Construct the POST request URL
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=19 :player=cld} | We're going to add functionality to an already existing app that allows you to select an image and display it on the screen. The functionality we're going to add in this tutorial is uploading the image to Cloudinary. (Later, we'll also deliver the image in the Flutter app from Cloudinary.) The initial step to uploading the image to Cloudinary involves constructing the URL for the POST request. Simply use the provided URL and replace `<cloudname>` with your product environment's cloud name, which we'll cover in an [upcoming step](#replace_cloud_name).
|

```flutter
final url = Uri.parse('https://api.cloudinary.com/v1_1/<cloudname>/upload');
```

### Use the Postman collection
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=46 :player=cld} | Check out our Postman collection for a working example of an unsigned upload via a POST request using the Upload API's [upload method](https://www.postman.com/cloudinaryteam/workspace/programmable-media/folder/16080251-01c1a754-63db-4c3f-9fc7-53cab03d906b?ctx=documentation). Keep in mind that you'll need an unsigned upload preset for this, which we'll create in an [upcoming step](#create_preset).
|

### Replace the cloud name in the POST request URL with your own
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=57 :player=cld} | To find your **Cloud name**, navigate to the Product Environment Credentials section in your [Dashboard](https://console.cloudinary.com/app/home/dashboard). Replace `ddjmx10sp` in the example Post request URL with your specific cloud name.
|

```flutter
final url = Uri.parse('https://api.cloudinary.com/v1_1/ddjmx10sp/upload');
```

### Create an unsigned preset
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=1 :sec=09 :player=cld} | Go to the Upload page of the Console Settings and scroll to the Upload presets section. Create a new upload preset by clicking **Add upload preset** at the bottom of the upload preset list. From the **Signing Mode** drop-down, select **Unsigned**. You can also optionally enter a folder where the images uploaded with this upload preset will be stored. After saving this upload preset, it will appear in the list of presets. Remember to note down the name of the upload preset you've just created, as you'll use it in your Flutter application as part of your request.
|

### Construct the image upload request
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=1 :sec=48 :player=cld} | Create the request for the upload method of the Upload API within your Flutter application. Make sure to replace `<preset_name>` with the name of the unsigned preset you created.
|

```flutter
final request = http.MultipartRequest('POST', url)
    ...fields['upload_preset'] = '<preset_name>'
    ...files.add(await http.MultipartFile.fromPath('file', _imageFile!.path));
```

### Retrieve and display the Cloudinary image
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=2 :sec=03 :player=cld} | Use the provided code to obtain the delivery URL from the upload response and display the Cloudinary image within your Flutter app.
|

```flutter
final response = await request.send();
if (response.statusCode == 200) {
    final responseData = await response.stream.toBytes();
    final responseString = String.fromCharCodes(responseData);
    final jasonMap = jsonDecode(responseString);
    setState(() {
        final url = jsonMap['url'];
        _imageUrl = url;
    });
}
```

### Additional upload methods 
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=2 :sec=44 :player=cld} | In addition to the method demonstrated, there are alternative ways to upload images from your Flutter app to Cloudinary. One such method is the user-friendly [Upload widget](flutter_image_and_video_upload#upload_widget) which provides an intuitive interface for users to upload images. If you prefer a back-end approach, you can opt for a [server-side](dart_image_and_video_upload#server_side_upload) upload, which necessitates your `api_key` and `api_secret`. Always exercise caution and avoid exposing your credentials in a client-facing front-end application.
|

## Keep learning

> **READING**:
>
> * Learn more about [uploading images and videos using the Flutter SDK](flutter_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 Flutter SDK
    Install and configure the Cloudinary Flutter SDK 
  

  
  
  
    Create Upload Presets (Node.js)
    Streamline media uploads using signed upload presets 
  

  
  
  
    Upload Widget
    Embed an Upload Widget in your site 
  

&nbsp;

&nbsp;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.
&nbsp;
