多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
3.0 KiB

---
title: 'Attachment'
description: 'This article explains how to create & work with an Attachment field.'
tags: ['Fields', 'Field types', 'Custom types', 'Attachment']
keywords: ['Fields', 'Field types', 'Custom types', 'Attachment', 'Create attachment field']
---
`Attachment` fields allow you to upload files to your records. You can upload any file type, and the file will be linked to the record. You can also upload multiple files to a single `Attachment` field record.
## Create an Attachment field
1. Click on `+` icon to the right of `Fields header`
2. On the dropdown modal, enter the field name (Optional).
3. Select the field type as `Attachment` from the dropdown.
4. Click on `Save Field` button.
![image](/img/v2/fields/types/attachment.png)
:::info
Max size for an attachment file is currently limited to 5 MB
:::
### Cell display
The cell display for `Attachment` field is either a clickable preview if file is an image in recognizable format or a file-type icon.
![image](/img/v2/fields/attachment-cell.png)
### Upload files
To upload files to an `Attachment` field,
- Click on the `+` icon in the cell, choose the file to upload and click on `Upload` button. OR
- Drag drop the file to the cell. OR
- Click on expand icon `<>`, choose the file to upload or drag-drop file; click on `Upload` button.
## Expand modal
Expand modal for `Attachment` field displays the list of files uploaded to the field. You can also upload files from the expand modal. To access expand modal, click on the expand icon `<>` in the cell.
![image](/img/v2/fields/attachment-expand.png)
Expand modal supports the following actions:
### Attach file(s)
- Click on `Attach file(s)` button {"<"}1{">"}
- Choose the file(s) to upload
### Delete file
- Click on `x` icon {"<"}2{">"} to the top left of the image card to delete the file
### Download file
- Click on `Download` button {"<"}5{">"} to download the file
### Bulk Download file(s)
- Select the files by clicking on the checkbox {"<"}3{">"} to the top left of the image card
- Click on `Bulk Download` button {"<"}4{">"} to download the selected files
### Rename file
- Click on `Rename` button {"<"}5{">"} to rename the file
- Enter the new name in the input field
- Click on `Rename` button to save the new name
:::note
Rename file only renames the file in NocoDB display (expand record & tool tip on hover). It does not rename the file in the storage.
:::
## Environment variables
In self-hosted version, you can configure the following environment variables to customize the behavior of `Attachment` field.
- NC_ATTACHMENT_FIELD_SIZE: Max size of attachment file in bytes. Default: 20MB
- NC_SECURE_ATTACHMENTS: Allow accessing attachments only through pre-signed URLs. Default: false
- NC_ATTACHMENT_EXPIRE_SECONDS: Expiry time for pre-signed URLs. Default: 7200
Find more about environment variables [here](/getting-started/self-hosted/environment-variables)
## Related articles
- [Attaching a file from mobile](/views/view-types/form#attaching-a-file-from-mobile-device)