Page History
This how-to describes how to use the multiple file upload.
UI Text Box | ||
---|---|---|
| ||
Note that Internet Explorer 9 (IE9) is not able to handle multiple files, only single files. In IE 10+, Firefox and Chrome multiple files works properly. |
For the functionality of multiple files you do not need to install any plug in.
...
To be able to handle files, a connection has to be specified. This connection states where the files should be stored. The connection can be specified in the aquima.properties
file in the home folder.
Currently there are two connection flavors:
in memory
or on file system
Ad 1) In case the files should be uploaded to memory add the following line at the end of the file:
Code Block |
---|
connection.<connection name>.memory |
Where <connection name> is a custom name of the connection, e.g. "connection.memoryconnection.memory".
Ad 2) In case the files should be uploaded to the file system add the following line at the end of the file:
Code Block |
---|
connection.<connection name>.filesystem.path=<your path> |
Where <connection name> is a custom name of the connection, e.g. "connection.filesystemconnection.filesystem.path=C:/Files/". Note to use '/' in your path, e.g. C:/Files/
.
See How to setup a connection.
Also check that your messages properties filecontains filecontains the following lines:
Code Block |
---|
#fileupload fileupload.label.single=Add file... fileupload.label.multi=Add files... fileupload.description.filesize=Maximum file size is: {0} fileupload.description.extension=Allowed file extensions are: {0} fileupload.validation.extension=File type not allowed fileupload.validation.filesize=File is too large fileupload.status.succes=File(s) uploaded successfully fileupload.status.failed=Upload failed because the following file(s) do not meet all conditions: |
...
Define a connection name as described before.
- Create an entity, e.g. 'File', in your model.
- Create at least one attribute: File.Id. This attribute is needed to store the id of the file, and without this attribute this functionality does not work. When handling files it is often practical to use a few other attributes such as File.Name, File.Type and File.Size. Create these attributes too.
- Create an exposed flow.
- Create a page which is put in the flow and is connected.
Create a container of type
AQ_File_Upload
and place it on the page with the following parameters. For more information on the parameters of this container see the Container type: AQ_File_Upload.Parameter Value Connection <connection name> Persistence Temporary Mode Multiple files FileID File.Id FileName File.Name FileType File.Type FileSize File.Size - Create a container of type
AQ_InstanceList
.- Let the containment be: File.Id, File.Name, File.Type, File.Size, all of them read-only
- Let the parameters be: Parameter 'entity' should be 'File'.
- Let the instance selector container be the second container on the page.
- The upload container is ready to use.
...
Create a AQ_File_Download
container and add the following parameters:
Parameter | Value |
---|---|
Connection | <connection name> |
FileId | File.Id |
ButtonText | DownloadText |
This container can be used in the containment of the instance list and it is ready to use.
...
To be able to delete a file you need a service for that. Create a new service of type AQ_File_Delete
. Enter the following parameters:
Parameter | Value |
---|---|
Connection | <connection name> |
FileId | File.Id |
RemoveInstance | True |
This service can be used in the flow when a delete event is triggered. This service can be used directly.
...
Next to the default meta data that are stored, it is possible to define some of your own. These can be specified in the CustomMetaData parameter of the Service call type: AQ_File_UpdateMetaData service. This is an example with one meta data.
Parameter | Value |
---|---|
Connection | <connection name> |
FileId | File.Id |
CustomMetaData | Meta = File.Meta |
The previous steps are needed for a simple and complete application. The following services and constructs can be used in more specific situations.
...
Is is possible to retrieve the meta data when providing an Id.
Parameter | Value |
---|---|
Connection | <connection name> |
FileId | File.Id |
FileName | File.Name |
FileType | File.Type |
FileSize | File.Size |
Move a File
By using the AQ_File_Move
it is possible to move a file from one connection to another connection. This could be useful when uploading to memory by default, adding some meta data and storing it on the file system afterwards. This service can be used by entering the following parameters.
Parameter | Value |
---|---|
ConnectionFrom | <connection name from one system> |
ConnectionTo | <connection name to another system> |
FileId | File.Id |
Trigger a flow when uploading
...
UI Expand | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
|
...
|
...