Document Modelling

Upload fields

Model upload fields in Sophora.

File

A File input field is designed to enable the upload of any kind of file. This field type operates only with childnodes of the type sophora-nt:binarydata, which is why you have to add that as a valid child node name in the childnode configuration. To enable the saving of filenames, configure document.file.saveFilePath in the configuration document. There are two parameters for a File input field. With both of them you can restrict what kind of files can be uploaded. If you do not set a value yourself, there won't be a limitation.

Parameters
ParameterDescriptionRange of Values
Maximum Size (in kB)Configure a maximum file size in kB.Positive integers
ExtensionsIf you want to restrict the set of file formats that can be uploaded with the File field, you can list all permitted document extensions in a comma separated list (e.g. pdf,png,jpg).Any file extension

File Upload

The input field type File Upload allows the user to transfer a file to a FTP or SFTP server. In the property configuration, the server and a folder have to be configured. The user can select a local file that will be uploaded to the configured location. File uploads run in the background an can be canceled. Once the upload is finished, the remote path will be stored in the property of the document.

Parameters
ParameterDescriptionDefault ValuePossible Values
ProtocolProtocol for transferring data to the target server.FTPFTP, SFTP
Target ServerThe address of the file server to which files will be uploaded. Optionally, you can additionally specify a port. If you don't, the well-known port for FTP (21) or SFTP (22) will be used.localhost:21Hostnames or IPv4 addresses, optionally ending with :port.
Target FolderThe folder on the file server to which the files should be saved..A file path on the server. It may contain placeholders (see below).
Target FilenameThe filename under which the files will be stored.${filename}A string which the selected server will accept as a filename. May contain placeholders.
UsernameThe username to log in to the file server.anonymousArbitrary text. Ideally a username which exists on the server.
PasswordThe password for the given user to log in to the file server.guestArbitrary text. Ideally the password of the selected user.
Character EncodingThe character encoding to be used by the FTP control connection.ISO-8859-1Valid character encodings for FTP.
Placeholders
PlaceholderDescription
${creationDate}The creation date of the document, in the form YYYY-MM-DD. If the document has not been saved yet, the current date is used.
${creationDate:day}The day of the creation date of the document (two digits). If the document has not been saved yet, the current date is used.
${creationDate:month}The month of the creation date of the document (two digits). If the document has not been saved yet, the current date is used.
${creationDate:year}The year of the creation date of the document (four digits). If the document has not been saved yet, the current date is used.
${externalId}The external ID of the document. If the document has not been saved yet, a random string is used.
${fileName}The name of the file being uploaded (only valid for the Target Filename parameter).
${fileExtension}The filename extension of the file being uploaded (only valid for the parameter Target Filename).
Browser Tab parametersSee here

Last modified on 2/22/24

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon