Basic usage
Learn how to use the FileUpload component to upload files.
Validating files
Basic validation
Both server and client side for file size and mime type validation are supported.
Client side
The FileUpload.Root
component can be configured with accept
, maxFileSize
and minFileSize
to validate file size and mime type.
Server side
The slingshot server profile can be configured with maxSizeBytes
and allowedFileTypes
to validate file size and mime type.
Custom validation
In case you require more complex validation, you can use custom validation handlers to validate files before they are uploaded.
Client side
The FileUpload.Root
component can be configured with a validate
function to validate files before they are uploaded.
You can also pass metadata that will be available to the server side.
Server side
Meta data passed from the client is available in the authorize
function.
Authenticate requests
Use the authorize
function to authenticate requests. You can use the req
object to check the request headers or cookies for a valid session.