# Uploading File Fields in Entity Records

> Using Studio you can easily manipulate specific files of an entity record. These activities allow you to execute operations such as upload, download, or delete specified files of a specified field of an entity record.
:::important
The maximum size of a single file cannot exceed 10 MB, otherwise unexpected behavior might occur.
:::

Using Studio you can easily manipulate specific files of an entity record. These activities allow you to execute operations such as upload, download, or delete specified files of a specified field of an entity record.
:::important
The maximum size of a single file cannot exceed 10 MB, otherwise unexpected behavior might occur.
:::

The following example contains a main XAML demonstrating how to [upload a file to Data Service](https://docs.uipath.com/activities/docs/upload-file-to-record-field), after downloading it from Olympics games related Wikipedia pages.

[Download example](https://documentationexamplerepo.blob.core.windows.net/examples/Data%20Service/Data%20Services_File-Example-Upload.zip)

## Prerequisite Step 1: Create Entities in Data Service

Following the steps detailed on the [Creating an Entity](https://docs.uipath.com/data-service/automation-suite/2024.10/user-guide/creating-an-entity#creating-an-entity) page, we created an entity for storing information about the Olympic games.

The **Olympics** entity has the following fields: Name (text) and Logo (file).
:::note
System built-in fields are automatically added to your entity in order to provide details about its creation.
:::

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-46972-98ab1284-65b64a20.webp)

## Prerequisite Step 2: Import the Entities in Studio

Import the entity inside your workflow in Studio.

The following workflow scrapes information and images about a certain Olympics edition, maps the found data to arguments, and passes them along to the main workflow.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-46820-0ff1cfd0-5289d709.webp)

## Step 3: Build the Workflow

### Query Related Records

We'll use the **Query Entity Records** activity to pull up a list of records from the Olympics entity from Data Service by setting up the `name` variable. This goes through all records from the **Name** field and outputs them in the `existingRecords` variable to be used in the following **If** activity.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47192-bbf7c4cd-ec7ee7cd.webp)

### If

Add the **If** activity allows us to take one of the following two different courses of action, depending on whether the cont for the `existingRecords` variable is 0 or not:

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47228-bf84e169-cdd29df7.webp)

#### 1. If a record does not exist, create it and assign values to it

If no records are found meaning that the `existingRecords=0` condition is met, create a new **Sequence**, use the **Multiple Assign** activity to assign values to the `olympics` and `olympics.Name` variables and the **[Create Entity Record](https://docs.uipath.com/activities/docs/create-entity-record)** activity to add the collected information to Data Service.

You can use the information available in the **Using Entities in Projects** page [Create Data Records section](https://docs.uipath.com/data-service/automation-suite/2024.10/user-guide/using-entities-in-projects#create-data-records) example.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47116-c93a7538-ae4010ed.webp)

#### 2. If a record already exists, assign values to it

If a record is found, meaning that the `existingRecords=0` condition is not met, use the **Assign** or **Multiple Assign** activity to assign the value to the `existingRecords` variable.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47156-4688d2c4-bcf554cd.webp)

### Upload File to Record Field

We use the **[Upload File to Record Field](https://docs.uipath.com/activities/docs/upload-file-to-record-field)** activity and upload the created file to the **Logo** field from the **Olympics** entity record.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47400-52dcf569-e3fa162f.webp)

### Delete the Local File

Remove the file that was downloaded locally from Wikipedia to our machine after uploading it to Data Service by using the [**Delete**](https://docs.uipath.com/activities/docs/delete) activity.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47108-f1ed4020-dab22708.webp)

### Display the Value of the Variable in the Output Panel

Add the [Write Line](https://docs.uipath.com/activities/docs/write-line) to display the value of the string variable, for this example we've added the `olympics.Name`, to the Output panel.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-46824-189d2b93-4d4e4088.webp)

Once finished, your project should look like this:

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47210-2b8ca74c-959c1e46.webp)
