Upload files and images in web apps
Learn how to upload files and images in web apps.
Retool provides a number of components that enable users to upload files in web apps:
These components have several configuration options that allow you to control what users can upload.
The maximum supported file size for file uploads is 40MB.
Add file upload functionality
Add one of these components to the canvas. This enables users to upload files from the web app.
Accepted file types
Use the File types option to specify an array of MIME types to allow for upload. The following examples are for common use cases.
- Documents
- Images
- Any
The following list contains MIME types for commonly used files, such as PDFs and Microsoft Word documents.
[
"text/*",
"application/*",
"application/pdf",
"application/msword",
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/json",
"application/rtf",
"application/xml"
]
Use ['image/*']
to allow the upload of any image.
The Any option uses ['*/*']
as the specified MIME type, allowing for the upload of any file.
Single or multiple selection
You can specify whether users can upload a single file, multiple files, or a directory of files. If you allow multiple files, you can also specify a minimum or maximum number of files to allow.