How to add a file field
Introduction
This How To explains how to add a file column and field to Openbravo. File columns allow to store small files into database tables allowing to upload and download these files from the Openbravo user interface.
![]() | This functionality is not intended to store large collections of files in the database nor big files. If you need to store big files or a lot of files use the Attachments functionality. |
The steps to add a file column and field to openbravo are the same as adding other type of columns and fields: 1.- Create the column in a table, 2.- Create a field in a tab associated to the table.
Add the column to the database
First, you have to add a new column to the existing table. The field must be of type VARCHAR(32) and must be a foreign key to the table AD_FILE where files information is actually stored.
When creating the new column in the application dictionary just select the File BLOB reference:
This reference also have three new properties:
- File Max Size: The maximum size of the file that can be stored. The unit for this size is defined in the field File Max Size Unit.
- File Max Size Unit: The units the field File Max Size is defined. It can be B (bytes), KB (Kilobytes, the default), MB (Megabytes), GB (Gigabytes).
- File Extensions: The allowed extensions of files this column can store. Extensions are separated by commas and if this field is empty any file extension is allowed.
Result
The result is a field that allows to download and upload files and offers a visualization of the file stored in the field: