# Azure Blob Storage file uploader

## Overview

Azure Blob Storage file uploader is a button to upload files to Azure Blob Storage. The uploader allows you to set ACL and specify file type restrictions and MIME types.\
File uploader sends user data directly to Azure using [Shared Access Signature (SAS)](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview) unlike data sources that send data through UI Bakery servers.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2Fu4sNMHgzr3mBtzYtd8I1%2FCleanShot%202025-07-14%20at%2011.26.05%402x-min.png?alt=media&#x26;token=b3bfbc47-9271-4fe2-a42c-a409bd2fc9cc" alt=""><figcaption></figcaption></figure>

### Properties

<table><thead><tr><th>Name</th><th width="144.32421875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>lastUploadedFileName</code></td><td><code>string</code></td><td>Name of the last uploaded file</td></tr><tr><td><code>lastUploadedFileUrl</code></td><td><code>string</code></td><td>Azure url of last uploaded file</td></tr><tr><td><code>name</code></td><td><code>string</code></td><td>Component name</td></tr></tbody></table>

### Triggers

<table><thead><tr><th width="207.44921875">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>On Upload Success</strong></td><td>Triggered when file upload is successful</td></tr></tbody></table>

## Working with the component

### Prerequisites

If you are planning to use the Azure Blob Storage file uploader in UI Bakery, you first need to [connect your Azure Blob Storage data source](https://docs.uibakery.io/reference/data-sources/azure-blob-storage) and set up **CORS policies** for your storage account.

To set up CORS policies, navigate to your *Storage account settings* > *Resource sharing (CORS)* and select the *Blob Service* tab. For the cloud version of UI Bakery, add the following configuration:

```json
[
  {
    "AllowedOrigins": ["https://*.uibakery.io"],
    "AllowedMethods": ["DELETE", "GET", "HEAD", "MERGE", "OPTIONS", "PUT", "POST", "PATCH"],
    "AllowedHeaders": ["*"],
    "ExposedHeaders": ["*"],
    "MaxAge": ["0"]
  }
]
```

{% hint style="warning" %}
If you're using a self-hosted or managed version of UI Bakery on a custom domain, use the domain where you run your UI Bakery platform in the `AllowedOrigins` section. Usually, it equals the value of the `UI_BAKERY_APP_SERVER_NAME` environment variable.
{% endhint %}

### To upload files to Azure Blob Storage:

1. Add the **Azure Blob Storage file uploader** component to the working area.
2. Select the necessary *Azure Blob Storage data source* from the dropdown.
3. Specify the container and set up other required settings.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FEXJW2FmSaq5UdBzOv9VS%2FCleanShot%202025-01-29%20at%2016.35.23%402x-min.png?alt=media&#x26;token=5fc94e6c-4377-4b35-bcb4-fc98afcb439b" alt=""><figcaption></figcaption></figure>

4. Next, click on the component and select the necessary file to upload it.&#x20;

Once it's uploaded, you will notice that the `lastUploadedFileUrl` is an Azure Blob Storage URL, and you can refer to it with the `{{ui.fileUploader.lastUploadedFileUrl}}` variable.

Also, if you need to call any action upon the file upload, you can use the **On Upload Success** trigger of the component.
