# uip df files

> `uip df files` manages blob attachments stored on a record's file field. All three verbs take the same three positional arguments — entity ID, record ID, and field name (case-sensitive). Field names are discoverable through [`uip df entities get`](./uip-df-entities.md#uip-df-entities-get).

`uip df files` manages blob attachments stored on a record's file field. All three verbs take the same three positional arguments — entity ID, record ID, and field name (case-sensitive). Field names are discoverable through [`uip df entities get`](./uip-df-entities.md#uip-df-entities-get).

## Synopsis

```
uip df files <verb> [options]
```

## Verbs

| Verb | Purpose |
|---|---|
| `upload` | Upload a file to a record field. |
| `download` | Download the file attached to a record field. |
| `delete` | Delete the file attached to a record field. |

## uip df files upload

Upload a file to a record field.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<entity-id>` | yes | Entity ID (UUID). |
| `<record-id>` | yes | Record ID (UUID). |
| `<field-name>` | yes | Name of the file field (case-sensitive). |

### Options

| Short | Long | Value | Default | Description |
|---|---|---|---|---|
| `-t` | `--tenant` | name | session default | Override the tenant. |
| `-f` | `--file` | path | required | Path to the file to upload. |

### Examples

```bash
uip df files upload a1b2c3d4-0000-0000-0000-000000000001 \
    b2c3d4e5-0000-0000-0000-000000000001 invoice \
    --file ./invoice.pdf
```

### Data shape (--output json)

```json
{
  "Code": "FileUploaded",
  "Data": {
    "EntityId": "a1b2c3d4-0000-0000-0000-000000000001",
    "RecordId": "b2c3d4e5-0000-0000-0000-000000000001",
    "FieldName": "invoice",
    "FileName": "invoice.pdf"
  }
}
```

## uip df files download

Download the file attached to a record field.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<entity-id>` | yes | Entity ID (UUID). |
| `<record-id>` | yes | Record ID (UUID). |
| `<field-name>` | yes | Name of the file field (case-sensitive). |

### Options

| Short | Long | Value | Default | Description |
|---|---|---|---|---|
| `-t` | `--tenant` | name | session default | Override the tenant. |
| — | `--destination` | path | `<record-id>_<field-name>.bin` | Output file path. |

### Examples

```bash
uip df files download a1b2c3d4-0000-0000-0000-000000000001 \
    b2c3d4e5-0000-0000-0000-000000000001 invoice \
    --destination ./invoice.pdf

# Default destination
uip df files download a1b2c3d4-0000-0000-0000-000000000001 \
    b2c3d4e5-0000-0000-0000-000000000001 invoice
```

### Data shape (--output json)

```json
{
  "Code": "FileDownloaded",
  "Data": {
    "EntityId": "a1b2c3d4-0000-0000-0000-000000000001",
    "RecordId": "b2c3d4e5-0000-0000-0000-000000000001",
    "FieldName": "invoice",
    "OutputPath": "./invoice.pdf"
  }
}
```

## uip df files delete

Delete the file attached to a record field. The record itself is unaffected — only the blob on the named field is removed.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<entity-id>` | yes | Entity ID (UUID). |
| `<record-id>` | yes | Record ID (UUID). |
| `<field-name>` | yes | Name of the file field (case-sensitive). |

### Options

| Short | Long | Value | Default | Description |
|---|---|---|---|---|
| `-t` | `--tenant` | name | session default | Override the tenant. |

### Examples

```bash
uip df files delete a1b2c3d4-0000-0000-0000-000000000001 \
    b2c3d4e5-0000-0000-0000-000000000001 invoice
```

### Data shape (--output json)

```json
{
  "Code": "FileDeleted",
  "Data": {
    "EntityId": "a1b2c3d4-0000-0000-0000-000000000001",
    "RecordId": "b2c3d4e5-0000-0000-0000-000000000001",
    "FieldName": "invoice"
  }
}
```

## Related

- [`uip df entities`](./uip-df-entities.md) — discover field names with `entities get`.
- [`uip df records`](./uip-df-records.md) — manage the records that own these attachments.

## See also

- [Data Fabric tool overview](./uip-df.md)
- [Global options](./global-options.md)
- [Exit codes](./exit-codes.md)
