# File Storage Helper

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FDlMzFtjr7fH2NAcfyeT5%2Fimage.png?alt=media&#x26;token=42a26a03-ce86-4752-80eb-61bcd2afca64" alt="" width="177"><figcaption></figcaption></figure>

## Overview

Using the **File Storage Helper**, you can store and save all kinds of files (CSV, XML, Excel, txt, etc.) to the Locoia app file system (S3 instance). From there, you can download those files using the URL you will receive as a result.

## Actions

### 1. Upload and publish files publicly accessible

This action takes a reference or a URL of the file and returns a publicly accessible URL.\
See an example of how a file `cars_csv` from the previous step is published and made publicly accessible:

{% hint style="info" %}
All other files in the Locoia ecosystem cannot be publicly accessed.
{% endhint %}

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FDCSefWuypSJs7yT7B07L%2F60%20min.png?alt=media&#x26;token=c093e389-789c-40e6-8e4e-46402129196e" alt=""><figcaption></figcaption></figure>

### 2. Store a file privately for later use in flows

This action takes a reference or a URL of the file and stores it privately.\
See an example of how a file `cars_csv` from the previous step is stored with a new Filename `car_manufactures`

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FZD6fOVq7mbnT5RKEuu6B%2Fimage.png?alt=media&#x26;token=5ebd0661-5a82-4f81-ae0a-d17a875c78e3" alt=""><figcaption></figcaption></figure>

### 3. Retrieve stored file for use in flows

This action takes a Filename and returns a URL where the file is privately stored.\
Retrieve a file by name `car_manufactures`:

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FxQVnTaBpyIRqTFRWxxVc%2Fimage.png?alt=media&#x26;token=6f19759c-5f0a-4f24-b360-476b44b1b0e1" alt=""><figcaption></figcaption></figure>

### 4. Create File

Creates a file with the desired name, content, and content type.&#x20;

You can provide content in either text (**plain**) format or Base64 decoded format. If the content is a base64 encoded string set the optional parameter **Optional encoding of the content** to **base64** and set the **Content type of the file** field based on the content type of the file that should be created.

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FP8Dr9B7PtQPrmUITyGXS%2Fcreate_file.png?alt=media&#x26;token=97d8954e-cb68-43dc-bc45-19ef11041ead" alt="" width="563"><figcaption></figcaption></figure>

## Common use-cases File Storage Helper

* Including a link rather than a file in an email
* posting a file (e.g. JPG image file or pdf file) against another API to upload it
* Create a file based on a text string (e.g. an XML file) or a base64 encoded file
