# 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="/files/OwXf5D8CmVq0GqkNEGSB" 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](/reference/data-sources/azure-blob-storage.md) 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="/files/8yaUi6RmWmJZ5NsDDsiX" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/reference/working-with-components/azure-blob-storage-file-uploader.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
