SpringBot File Upload
By Kellie Lutze 2 July 2020 Techies
The file attribute allows users the ability to integrate file upload functionality into their application.
Overview of the Model
File upload functionality is made availble through the File Upload attribute type in the Entity diagram.
The File Attribute
To enable file upload we need to first add a file attribute to one of our entities.
The new file attribute in SpringBot supports the use of Amazon S3 as the single file storage provider. To utilise the file attribute an S3 account must exist.
Once you have built your application you will need to configure your S3 credentials so that the application can utilise the file service. Not configuring these details may cause your application to fail to start. The key values that need to be configured are as follows:
|aws.s3.audio.bucket||The bucket details.|
|aws.access.key.id||The ID of the key to be used. To create this see here.|
|aws.access.key.secret||The secret part of the key pairing. Please see
|aws.region||The region of the bucket. For example
These need to be placed within one of the run profiles for the server-side application. For example, a development set of credentials would be placed within
serverside/src/main/resources/application-dev.properties like so:
# % protected region % [Add any additional properties here] on begin aws.s3.audio.bucket=example-bucket-name aws.access.key.id=xxxxxxxxxxxxxxxxxxxxxx aws.access.key.secret=xxxxxxxxxxxxxxxxxxxxxxx aws.region=ap-southeast-2 # % protected region % [Add any additional properties here] end
NOTE: Placeholder properties already exist within
serverside/src/main/resources/application-default.properties These properties will allow the application to build but will prevent the file upload from working until you have set your own credentials.
Using the File Upload Feature
Now that the file attribute has been added and your S3 details configured, you can now use it from within the administration section or CRUD tiles in the same way that other attributes can be used.