Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 6 Designing Formflows : Managing Files in Formflows

Managing Files in Formflows
Files can be retrieved or provided in a formflow using the File control. For example, an end user can specify the path to a Microsoft Excel spreadsheet in a form, and the spreadsheet contents can be accessed in the formflow. If a spreadsheet has already been provided, users can click a link in a form to view the file or save a local version.
Each instance of the control can handle one file at a time. When the Show Form activity is executed in a formflow, only the file path and filename are stored in the form state. The behavior of the File control depends on whether the control is writable or read-only.
Uploading Files
When an end user provides (uploads) the file, a writable control is used. File controls are writable by default. The user clicks on the Browse button to navigate to the desired file on their hard drive to select a file to upload.
To Prepare a File to Upload
1.
Figure 37 Prepare File to Upload
In the Tester, or at runtime, the form looks such as the following:
This form allows you to browse for a file on your hard drive, to view the file, and then to upload it (or to cancel the operation).
 
Downloading Files
When an end user retrieves (uploads) a file, a read-only control is used. The user clicks on provided link to download the file. If you want to allow users to view files before downloading, you need to provide an appropriate formflow.
To Prepare a File to Download
To prepare a file for downloading, you will first specify that file as input, then add a Show Form activity to display the file, and finally provide button to download the file.
1.
Figure 38 Prepare File to Download
2.
The process diagram shows the activity Set Download File, in which you will define the file used as input. In this example, the input file is named tib_release_notes2.pdf.
3.
Figure 39 Enable File for Viewing
4.
Figure 40 Downloaded File in Tester
The link is active the Tester utility or at runtime, but it is inactive when the form is previewed.
Temporary Files
At runtime, file content is written to a temporary directory on the machine where the servlet engine is running. The directory is specified by the value of the javax.servlet.context.tempdir property for the servlet engine. For example, for Tomcat, this location is tomcat_install_dir/work/Catalina/localhost/web_application_context. The user who starts the servlet engine must have write permission on this directory.
This location is specified by the TemporaryDirectory attribute of the Get Formflow Context activity. During formflow processing, the temporary directory can be used to store temporary files. When the servlet engine is started, all files in this directory are automatically deleted.
When a formflow with a File control runs in the Tester utility, file content is written to user_home_directory/.tibco/.formflow/Work, for example:
C:\Documents and Settings\Administrator\.TIBCO\.formflow\Work\SESSIONS.ser
The user who starts TIBCO Designer must have write permission on this directory.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved