VB: Store and Download Files
Published in
2 min readFeb 5, 2021
DISCLAIMER: The views expressed in this story are my own and do not necessarily reflect the views of Oracle.
Overview
This article describes how to store and download files from the Resources directory in Oracle Visual Builder.
Setup
NOTE: For this example, we will store a file called Test.docx in the Resources directory and then download it using a button.
Resources
- Right click on the Resources directory and click Import as shown below.
- Set the name of sub-directory (e.g. /resources/files) and then upload the file (e.g. Test.docx).
- After importing, the file should be in the resources directory as shown below.
Action Chain
- Create an action chain that opens the file URL. In this case, the URL is
[[ $application.path + 'resources/files/Test.docx' ]]
HTML
- Create a button with an ojAction event that calls the above action chain.
<div class="oj-flex">
<div class="oj-flex-item oj-sm-12 oj-md-12">
<oj-button on-oj-action="[[$listeners.ojButtonOjAction]]">Download</oj-button>
</div>
</div>
Test
- Run the application and click on the Download button. The file should be downloaded on your local computer as shown below.