This library will enable your applications to download files held on Convertigo server.
In many applications, it is useful to provide buttons or links to trigger a download of a file (PDF, Document, Photo etc ... ) generated or held on a file system accessible by a Convertigo server. By default, Convertigo can only serve files located in the project workspace, without controlling access to these file. If you want to serve files located outside the workspace and want a fined grained control with some business logic to enable or not the download, you should use this library.
The back-end part of the library is the get_file sequence. This is a private sequence so it cannot be called directly by a client. You must create your own sequence controlling the business logic and if the user is enabled to do so call the get_file sequence within you own custom sequence.
The library provides a sample demo_lib_usage showing this
On the Front-end side, you must trigger a file download by calling this custom sequence. To do so the library provides a getFile SharedAction you can use within your project. A Sample application with a "Download File" button is provided showing how to call this Shared Action from your project.
For more technical informations : documentation
-
In your Convertigo Studio click on to import a project in the treeview
-
In the import wizard
paste the text below into the
Project remote URL
field:Usage Click the copy button at the end of the line To contribute lib_download_file=git@github.com:convertigo/c8oprj-lib-download-file.git:branch=master
To simply use lib_download_file=git@github.com:convertigo/c8oprj-lib-download-file/archive/master.zip
-
Click the
Finish
button. This will automatically import the lib_download_file project
Demo sequence to show the get_file sequence usage
variables
name | comment |
---|---|
file_path | Absolute path to the file to download. Or use './/' to a file path relative to project folder. Or use './' to a file path relative to workspace folder. |
Private sequence to be called from a parent sequence. The parent sequence must be called with .bin requester.
variables
name | comment |
---|---|
file_path | Absolute path to the file to download. |
The shared action getFile is used to trigger a download file in a Convertigo NGX Application.
Drag and Drop the getFile shared action in an event (onClick of a button, for example) and set the file_path variable to the path of the file to download from Convertigo Server file system and the target_sequence variable to a sequence performing the necessary business logic to control whenever or not the user is enabled to download a file prior to call the librari's get_file Sequence.
Action to trigger a file download in your Application.
variables
name | comment |
---|---|
callback | Callback sequence. This is the parent sequence performing the control business logic that finally calls the get_file sequence to perform the file download. |
file | The path to a file on the server to download. The path can be absolute , relative to the project (.//) or relative to the workspace (./) |