File Blazor Managed File Upload Example
provides an easy and flexible way to create API services backed by either popular cloud solutions like AWS S3, Azure Blob Storage, or your own file system.
By utilizing AutoQuery and Locode features, you also get a generated UI to use for back office staff or to use for prototyping. In this demo we configure three different storage types which integrate directly with your own database tables.
- AWS S3 Bucket
- Azure Blob Storage Container
- Local Application File System
The FileUploadFeature plugin uses the ServiceStack IVirtualFiles abstraction where multiple named providers can be used and referenced against your database model. Your own database stores metadata about each file including a reference to HTTP file path where the file where it can be downloaded.
Your table data for the files in this demo are then shared using AutoQuery services. AutoQuery provides the overridable service implementation to manage this data, this is where you can link your FileUploadFeature to specific table data using the
ServiceStack Locode App integrates with the FileUploadFeature plugin to enable a way to manage your files straight away.
The UploadFeaturePlugin provides overridable options to better control upload/download rules. In this demo,
Private files are stored in single table for each upload location.
Access rules are configured for each of the upload locations independently using the following plugin options.
- readAccessRole - Can limit read access to specific user roles
- resolvePath - Control how the upload path is created
- validateUpload - Filter upload requests
- validateDownload - Filter download requests
Since AutoQuery services are ServiceStack services, they benefit from being highly interoperable. This FileBlazor demo uses native Blazor components to upload to the generated API services providing a user friendly drag and drop interface.