Goal
This how-to describes how to use the multiple file upload.
Note that IE 9 is not able to handle multiple files, only single files. This is doing fine in IE 10+, Firefox and Chrome.
For this functionality you do not need to install any plugin.
Configuration
Please configure the connection in aquima.properties file in the home folder first. Currently there are two connection flavors:
Memory
connection.connection.memory
File system
connection.connection.filesystem.path=<your path>
Replace <your path> with the correct path. Note to use '/' in your path, e.g. C:/Files/.
Also check that your language properties file (e.g. messages_en-GB) contains the following lines:
#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:
Multiple File Upload
To build this functionality the following steps have to be taken.
Define a connection name as described earlier.
- Create an entity, e.g. 'File', in your model.
- Create at least one attribute: File.Id. For convenience add also File.Name, File.Type and File.Size.
- 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 put it on the page) with the following parameters:
Parameter Value Comments Connection connection Persistence Temporary Mode Multiple files FileInstance File The name of the entity defined in step 2. FileID File.Id FileName File.Name FileType File.Type FileSize File.Size - Create a container of type AQ_InstanceSelectorPlus.
- Let the containment be:
- File.Id, File.Name, File.Type, File.Size, all of them read-only
- A button 'Delete' (with a corresponding event, connect it in the flow with the AQ_File_Delete service)
- A download container (see 'Download File')
- Let the parameters be:
Parameter 'entity' should be 'File'.
- Let the containment be:
- Let the instance selector container be the second container on the page.
Download File
To get the download file container work, first create a text item with the name 'DownloadText' and enter some text, e.g. Download.
Create a AQ_File_Download container and add the following parameters:
Parameter | Value |
---|---|
Connection | connection1 |
FileId | File.Id |
ButtonText | DownloadText |
Delete File
Create a new service of type 'AQ_File_Delete'. Enter the following parameters:
Parameter | Value |
---|---|
Connection | connection1 |
FileId | File.Id |
Runtime
<screenshot>
Flowing after an upload
..
Example application
See the file upload example project.