Skip to content

Files

Files (for download) are defined in the contributions.json file. A file is described by the following JSON:

{
"id": "string", // required
"file": "string", // required
"description": "string" // optional
}
  • id Used for referencing the file.
  • file The relative path to the file.
  • description An optional description, mainly used for administrators.

The following snippet defines a file for download:

{
...
"contributions": {
"files": [
{
"id": "fileId",
"file": "files/my-excel-file.xlsx",
"description": "This is a custom file for download."
}
]
}
}

In a view, a link to the file can be generated by using the SCIFEON.Utils-object:

<template>
<div class="page-with-header">
<div class="page-header">
<h1>Scifeon Skeleton App</h1>
</div>
<div class="page-panels">
<p>Download file, by path reference: <a href="${ SCIFEON.Utils.getFileUrl('/files/my-excel-file.xlsx') }">my-excel-file.xlsx</a></p>
<p>...or by ID reference: <a href="${ SCIFEON.Utils.getFileUrl('fileId') }">my-excel-file.xlsx</a></p>
</div>
</div>
</template>