# Upload a file

## Upload file in a jig

{% columns %}
{% column %}
In this example, an expense claim form allows you to capture expense details and upload a file, such as a slip or invoice.

The `media-field` is configured to accept `any` file type, with a `maximumFileSize` set to ensure files remain within acceptable limits. An `execute-entity` action creates the record in the datasource and links the uploaded file to the record by using the `create` method, with the `file` specified in the `localPath` property.
{% endcolumn %}

{% column %} <img src="/files/dN3Rdxgoex3SLopVq3iY" alt="" width="170">
{% endcolumn %}
{% endcolumns %}

{% tabs %}
{% tab title="file-create-expense.jigx" %}
{% code fullWidth="true" %}

```yaml
title: Expense Claim
description: Expense
type: jig.default

header:
  type: component.jig-header
  options:
    height: medium
    children:
      type: component.image
      options:
        source:
          uri: https://cdn.pixabay.com/photo/2016/05/04/23/02/receipts-1372960_1280.jpg

onFocus:
  type: action.reset-state
  options:
    state: =@ctx.components.expense.state.data

children:
  - type: component.form
    instanceId: expense
    options:
      isDiscardChangesAlertEnabled: false
      children:
        - type: component.field-row
          options:
            children:
              - type: component.text-field
                instanceId: expenseitem
                options:
                  label: Expense detail
              - type: component.number-field
                instanceId: expenseamount
                options:
                  label: Amount
                  format:
                    numberStyle: currency
                    currency: USD
        # Use the media field to select the file to be uploaded.           
        - type: component.media-field
          instanceId: expenseimage
          options:
            label: Expense receipt
            mediaType: any
            maximumFileSize: =500 * 1024 * 1024
            isMultiple: false

actions:
  - children:
      - type: action.action-list
        options:
          title: Submit
          isSequential: true
          actions:
            - type: action.execute-entity
              options:
                provider: DATA_PROVIDER_DYNAMIC
                entity: default/expenses
                # Configure the create method with a file property,
                # the file will be linked to the record.
                method: create
                goBack: previous
                data:
                  expenseitem: =@ctx.jig.components.expenseitem.state.value
                  expenseamount: =@ctx.components.expenseamount.state.value
                file: 
                  localPath: =@ctx.components.expenseimage.state.value
```

{% endcode %}
{% endtab %}
{% endtabs %}

In Management the record is created in the **expense** dynamic data table and the file is linked to the record. The file and metadata is displayed in the file tab of the record. The file thumbnail is displayed in the system file column (use column settings to set the column to visible).

<figure><img src="/files/ejB51MAlFYCs8FAJaJjN" alt="iles in Management"><figcaption><p>Files in Management</p></figcaption></figure>

## Upload a file in Jigx Management

Files can be uploaded in Management by following these steps:

1. Log in to <https://manage.jigx.com>.
2. Browse to the required solution's **data** tab and select the record you want to add a file too, or create a new record.
3. Select the **File** tab, and add the file.
4. Add a **Name** for the file and include the file extension. If no file name is specified the name of the file is used.
5. Click the **Save** button.
6. The **status** of the file upload is shown in the top left corner of the File tab.


---

# 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.jigx.com/examples/readme/data-providers/dynamic-files/upload-a-file.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.
