0

File Upload

  • updated 10 mths ago

Description

The file_upload part allows your application users to upload images, documents, audios, videos, and other file types. You can use this to upload files of various file types to the server. When the system stores the file it also saves the returned variables in a data object, which you can use in your application in subsequent processing steps. This part is often used in conjunction with the file download part.

Use

The Designer User can specify what file types are permissible (based on extension) for their application, and store them in a single folder or unique folders associated with the session, user or any other business object. Error messages inform the user of file upload failure due to file type, storage space etc.

Note there are some special characters (like "em dash") that are not allowed in filenames.

 

Tips & Tricks

When allowing a single file upload, the file details are stored in a container (called upload_result in the example project below). If allowing multiple files to be uploaded at once, this variable becomes a collection. Watch out for any changes to rules or other logic your model to reference collection data vs container data.

If using File Upload, consider following it with the Download part so that users can see WHAT file they uploaded, and delete it as necessary (uploaded in error, provide updated copy of file, etc.)

When deploying this part in an multi-user and/or multi-session application all files are uploaded to the same location (and are therefore visible by the Download part). Consider using a unique identifier from the session (client_ID, datetime stamp or a manipulated folder name etc.) as a subfolder to insure different users/sessions dont display files uploaded previously.

If your workflow is such that an adminstrative function needs to access/archive the uploaded files, consider building a simple application that allows a user to enter a subfolder name (e..g dropdown of all client IDs) and then presents all uploaded files for that session.

Editor Fields

Field Name Description/Use Type/Options Optional/Mandatory
HTML enabled
(v8+)
When this is enabled you can put HTML formatting in the Question caption, which means the system will display HTML tags in the text in the caption editor as they would appear in a browser. The editor browser provides limited HTML editing options for text formatting. You can toggle the HTML-enabled button on and off to alternate between seeing and editing tags and displaying them as they will appear. Yes | No Optional
Caption This specifies the caption that the system will show with the upload control. Text Optional
Show Feedback If you check this checkbox the system will display warning or success messages to your application users when they upload a file. If you leave this checkbox empty the system will not display validation messages. Checkbox Optional
Default File Name This is the file name that the system will apply to the file when it is uploaded. When this is left blank the system stores the file using its original name. Text Optional
Directory This is the location to which the system uploads file(s). Text Mandatory
Place file in temp-folder When this option is checked the system uploads the files to the \temp folder in the dat folder of your LogicNets installation. Checkbox Optional
Sub folder

This option becomes available when the storage location is set to '(local) \appdata' or '(local) \temp'. It allows you to specify the subfolder within the given directory to which the system must upload file(s).

Note that when using the Download part in the same application, the subfolder should be matched if you want to be able to download the uploaded file.

Text Optional
(whitelisted) Path This option becomes available when the storage location is set to 'external directory'. It allows you to specify the path to the external directory.

Note that you must whitelist external directories in the settings.cfg file before the system will allow the file to be uploaded. See Whitelisting Directories for more information.
Text Mandatory
Storage location This indicates the location in which the system will store an uploaded file.
  • (local) \appdata: The \appdata folder in the company/dat folder of your LogicNets installation. Use this option for permanent storage within the LogicNets environment.
  • (local) \temp: The \temp folder in the company/dat folder of your LogicNets installation. Note: The system periodically clears the \temp folder.
  • External directory: A custom location outside of the standard \appdata and \temp folders.
Choice Mandatory
Unique File Name If you set this to 1, the system will append a time stamp to the front of the file name to make the uploaded file name unique. This prevents the file from being overwritten by a later version. Number Optional
Result This is the data object in which the resulting information from the upload action is stored. It includes the following fields: status, feedback message, uploaded file name (which will include the time stamp if Unique File Name is checked - see above), upload target, original file name, time stamp, and extension. Text Optional
Upload Button Caption This is the title the system will display to the user on the document upload button. If you leave this field empty the system will use the default of "Upload". Text Optional
Cancel Button Caption This is the title the system will display to the user on the document cancel button. If you leave this field empty the system will use the default of "Cancel". Text Optional
Success Message This is the message the system displays when a file is successfully uploaded. The system will only display message if you checked the Show Feedback checkbox. If you click the Show Feedback checkbox but do not enter a message in the Success Message field the system will use the default message "Successfully uploaded the file." and append the name of the uploaded files after a colon. Text Optional
Cannot Open File Message This is the message the system displays to the user if the system cannot open the uploaded file. The Show Feedback function must be active for the system to display the message. If Show Feedback is active and you do not enter a message in this field the system will display the default message "Cannot open output file: [name of the file]". Text Optional
No File Name or Extension Message This is the message the system displays to the user if the system cannot find the filename or extension. The Show Feedback function must be active for the system to display the message. If it is active and you do not enter a message in this field the system will display the default message "No filename or extension found". Text Optional
Accepted File Extension(s)

This feature allows you to specify the file types the end-user can upload

  • use .pdf to limit the user to uploading PDF documents 
  • enter image/*  to allow all types of image files or image .jpg to specify that the system only allow the end-user to upload .jpg files.
  • If you want to include more than one file type, include a comma-separated list of unique file type specifiers.
  • If you leave this field blank the system will allow users to attach all file types during the upload process.

Consider using a custom error message for when an incorrect file type is loaded (No File Name or Extension Message is shown.

Click here for a link to accepted file extensions.

Text Optional
Allow multiple files

If you check this checkbox the system will enable multiple file upload functionality and users will be able to select and upload multiple files at once. 

Watch out! The results of the file upload process are stored in a collection when allowing multiple files, even if only one file is uploaded. When this option is NOT checked, the results are stored in a container.

Both the collection and container are named according to what is written in the result parameter.

Checkbox Optional
Submit on click If you check this checkbox the system will advance the user forward one node after completing the upload.  Checkbox Optional

Example

Download and import the following example project in your workspace.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 1 yr agoLast active
  • 93Views
  • 5 Following

Home