1. Column type File

    Article: AN0001613Updated: 10.05.2021

    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).
    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: 

    Name Description
    OG Common object for scripts.
    OGForm Object for work with page content.
    OGModel Model containing the column.
    OGClassDef Class containing the column.
    OGColumn Column of type File.
    OGFileInfo Information about file.
    OGActualMessage Object for setting up message from 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:

    Name Description
    OGModel Model, to which the column belongs to.
    OGDataParent Class, to which the column belongs to.
    OGColumn Column of type File.
    OGActualDataRowId ID of the record to which the file belongs to.
    OGFileTmpCode Code of the file. It is defined if the DataRow is not yet stored n the database.
    OGFileName File name.
    OGFileContent File content in bytes.
    OGFileMimeType Mime type of the file.
    OG Common object for scripts.

    Objects for script Before record deletion:

    Name Description
    OGDataRowFile File
    OGModel Model, to which the column belongs to.
    OGDataParent Class, to which the column belongs to.
    OGColumn Column of type File.
    OG Common object for scripts.
×