# Upload Files to Azure Blob Storage

## Environment

<table>
    <tbody>
        <tr>
            <td>Product</td>
            <td>FileSelect for Blazor, <br /> Upload for Blazor</td>
        </tr>
    </tbody>
</table>

## Description

How to upload files to Microsoft Azure Blob Storage by using Telerik Blazor components?

Can I upload files directly to Azure Blob Storage?

## Solution

Both the [FileSelect](https://www.telerik.com/blazor-ui/documentation/components/fileselect/overview) and [Upload](https://www.telerik.com/blazor-ui/documentation/components/upload/overview) components can help with uploading files to Azure Blob Storage. There are some [differences between how the two components work](https://www.telerik.com/blazor-ui/documentation/components/upload/overview#upload-vs-fileselect), which will determine the exact usage.

### Using FileSelect

The `TelerikFileSelect` provides the selected files to the .NET runtime as a `System.IO.Stream`. Use the [`OnSelect` event](https://www.telerik.com/blazor-ui/documentation/components/fileselect/events#onselect) to obtain the file and send it to the Azure blob service.

### Using Upload

The `TelerikUpload` needs an HTTP endpoint, which will receive the uploaded file via a **POST** request.

The Azure Blob Service does not expose such HTTP endpoint. Do the following:

1. [Implement a `Save` controller action method](https://www.telerik.com/blazor-ui/documentation/components/upload/overview#implement-controller-methods) in the Blazor app.
2. Set the action method URL as a `SaveUrl` in the Upload.
3. Send the uploaded file to the blob service after you obtain it in the `Save` action method.

In this way, the file will go to your Blazor app server first, then to the Azure storage.

### Security

No matter which component you use, we recommend sending the file to the Blazor application server first. This will spare the need to expose sensitive authentication information about the blob storage to the client.
