Article: AN0001613Updated: 04.09.2024
This type is used for storing files.
Properties
Name |
Description |
Max. number of files |
It defines, how many files can be attached to the record in the given column. Počet se týká jen nesmazaných souborů. Number of deleted files is not limited. |
Max. file size |
It defines max. size of the file, that can be attached to the record. You have to add a unit in the combobox (B, KB, MB) to the number. |
File deletion type |
It determines the way of file deletion in the record. |
Display pictures in gallery |
It determines, wheather files of the type picture shall be opened in a gallery that the user can browse. |
Way of storing files |
It determines how the file shall be stored. User can choose between database, disk storage or Filestream (if configured). Disk storage for storing files is defined in the web.config file in parameter File\StoreRootPath. Files from a particular column are then stored in the folder FileStoreRootPath / _model id_ / _class id_ / _column id_ . |
List of allowed suffixes |
If you want to restrict upload of files only to specific suffxes, enter here list of suffixes separated by comma. |
Delete the oldest file |
If Max. number of files is exceeded by adding a new file, the oldest file will be deleted if this option is checked.
Otherwise error message is returned.
|
Script for restriction of returned file content
It is possible to define a script, that can control, whether the user is authorized to read the file. If the user clicks in the record detail on the link for file download, the script can perform a detailed check, whether the file content can be displayed to the user.
State return true at the end of the script, if the user can display the file or, return false for disabling file display.
If you want to deny file download to the user, you can inform him by an errror message:
OGActualMessage.SetError('You are not authorized to downloaded the file.');
return false;
Properties available in the script:
You can use only function for Error in the OGActualMessage object. Functions for Info and Success are not available here.
File deletion type
There are these possibilities:
- Not to delete - deletion of an attached file is not possible.
- Delete logically - the file is marked as deleted. However, it is possible to display it.
- Delete only file content - the file is marked as deleted and it is not possible to display it.
- Delete physically from the database - the file is completely and permanently deleted from the database.
Rules
There can be two rules defined on a column. One is Before new record save and second Before record deletion. There can be only script defined for both cases.
Objects for script Before new record save:
Objects for script Before record deletion: