Attachment
The Attachment
component allows your users to upload files to your Budibase app.
Uploaded files are stored in MinIO.
The Attachment
component works especially well with Budibase DB's Attachment data type.
Filesize
Remember the maximum file size you can store in your database of choice
Adding an Attachment component
The Attachment component
requires a Form component as a parent.
To add the Attachment component, click Form > Attachment
.
After the Attachment
component is added you can immediately start using it, no further configuration is required.
Manage access
If you want to specify user roles such as allowing public file uploads, then you'll need to adjust the write access levels of your table.
Validation
There are few Form validation options for the attachment field.
Constraint | Description |
---|---|
Required | At least one file must be uploaded. |
Max file size (MB) | No uploaded file can exceed the specified limit in megabytes. |
Max total upload size (MB) | The total size of all uploaded files cannot exceed the specified megabytes limit. |
Specifying acceptable file extensions
By default any file, with any file extension, will be accepted by the Attachment component for upload. However, in certain scenarios, a particular set of file extensions may preferred. For example, you may only want to accept PDF files. In other situations, you may only want image files.
The extensions property accepts an array of file extensions, e.g. [".webp",".png"]
. When Using Handlebars , make sure to split the comma separated array. If Using JavaScript, simply return an array of extensions as shown below.
{{ split ".png,.jpg,.jpeg,.svg,.gif,.webp" }}
return ['.png','.jpg','.jpeg','.svg','.gif','.webp']
This will result in the operating system's native File Open Dialog having a corresponding custom filter:
Updated about 2 months ago