IntroductionOverview
Users can upload their own files into PhixFlow using actions. This can be done using either a
Insert excerpt |
---|
| _action |
---|
| _action |
---|
nopanel | true |
---|
|
which links to a
Insert excerpt |
---|
| _file_collector |
---|
| _file_collector |
---|
nopanel | true |
---|
|
, or an
Insert excerpt |
---|
| _actionflow |
---|
| _actionflow |
---|
nopanel | true |
---|
|
containing a file upload node. This
can will allow users to
:- Upload images/files and store the details of where to access them as a record.
- Upload files to be used in an analysis model. These files can be made available for users to download.
Example
In a simple contacts application, it is possible using file uploads to:
- Allow an application user to upload their own image against a contact:
Image Modified
- Bulk upload excel Excel files containing multiple contacts to appear within an application.
- Download and files uploaded at a later datefiles stored on the server. These could be previous file uploads.
Solution
Images and files are stored on the server when uploaded by a file collector. These files are placed into a standard directory and need to be moved into an appropriate directory which can be accessed by the front end. To find out how to create these directories on the server, see XXXSee your system administrator for help creating these directories.
Once the new directory has been created, the following is required:
- an action configured to upload a file
- an analysis model
is required, - containing a file collector and a table
. An action will then run this model, the user will upload a file, the file collector will move it to the correct folder and the URL to access this file will be stored in an attribute on the table.Setting up an analysis model to upload and move a file with an action- a task plan that runs the analysis model
This is a worked example to set up a model that collects an uploaded file, moves it, and all the upload subdirectories, to the required new directory using an archive location on a file collector, to tell the collector where to move the file once it has been processed.
When files are uploaded via an action, they are initially stored under the default upload directory, this is specified in your system configuration. For example:
Code Block |
---|
/opt/phixflow/data/phixflow/upload |
A subdirectory is created for each uploaded file, in the form:
Code Block |
---|
/opt/phixflow/data/phixflow/upload/[tag]/in/[uploadDate]/[uploadID]/[filename] |
where
- [tag] is the tag specified by the action or file collector,
- [uploadDate] is the date of upload represented in a numerical string,
- [uploadID] is a unique string used to identify each file, and
- [filename] is the name of the uploaded file.
When uploading files through the front end , we aim to move the files to a location under (either directly or via soft link) the below directory while preserving these subdirectories in order to uniquely reference each file.
Code Block |
---|
/opt/phixflow/data/phixflow/datalink |
Creating the action1. Creating the Action to Upload a File
- In the File Upload section, tick File Upload and enter a Tag Expression (e.g. "contact").
- The exact tag used does not matter but needs to be used later to reference the upload location.
- Ticking File Upload means that running the action will trigger a file upload prompt, allowing the user to select a file to upload
.- :
Image RemovedImage Added
2. Creating the
analysis modelAnalysis Model
- Create a new analysis model and create a
Insert excerpt |
---|
| _file_collector |
---|
| _file_collector |
---|
nopanel | true |
---|
|
. Apply the following settings: