Documentation Index
Fetch the complete documentation index at: https://mintlify.com/formsmd/formsmd/llms.txt
Use this file to discover all available pages before exploring further.
Overview
ThefileInput method creates a file upload field that allows users to select and upload files. It supports size limits, image-only restrictions, and displaying current files.
Method Signature
Parameters
The unique identifier for this input field. Used to reference the uploaded file in form submissions.
Required Parameters
The main question or label displayed to the user.
Input-Specific Parameters
Maximum file size in megabytes (MB). Defaults to
10 MB if not specified.When set to
true, only image files (JPEG, PNG, GIF, WebP, etc.) are accepted.URL of the current/existing file. Use when editing forms to show the currently uploaded file. For best results, use a full URL.
Shared Parameters
All standard form field parameters are supported. See textInput for the complete list includingrequired, description, fieldSize, disabled, and more.
Examples
File Type Restrictions
- Image Only
- All File Types
- Custom Restrictions
When
imageOnly: true is set, the input accepts:- JPEG/JPG (
.jpg,.jpeg) - PNG (
.png) - GIF (
.gif) - WebP (
.webp) - SVG (
.svg) - BMP (
.bmp)
Size Limits
The
sizeLimit parameter specifies the maximum file size in megabytes (MB).Common Size Limits
| Use Case | Recommended Limit | Example |
|---|---|---|
| Profile pictures | 2-5 MB | sizeLimit: 2 |
| Documents (PDF, DOC) | 5-10 MB | sizeLimit: 10 |
| High-res images | 10-20 MB | sizeLimit: 15 |
| Presentations | 20-50 MB | sizeLimit: 50 |
| Videos (small) | 50-100 MB | sizeLimit: 100 |
Backend Integration
Google Sheets Integration
When using Google Sheets as your backend, files are automatically uploaded to Google Drive:- Upload the file to your Google Drive
- Store the Drive URL in your spreadsheet
- Make files accessible through Drive sharing settings
Custom Backend
For custom backends, files are sent as multipart/form-data:Use Cases
Applications
Collect resumes, cover letters, and portfolios.
Profile Images
Upload avatars and profile pictures.
Documents
Receive contracts, agreements, or certifications.
Support Tickets
Attach screenshots or files to support requests.
Best Practices
Set appropriate size limits
Set appropriate size limits
Match the size limit to your use case:
Clear file requirements
Clear file requirements
Use the description to specify requirements:
Show current files
Show current files
When editing, show the currently uploaded file:
Provide visual feedback
Provide visual feedback
The file input automatically shows:
- Selected filename
- File size
- Upload progress
- Current file (if specified)
Security considerations
Security considerations
Always validate files on the backend:
- Check file size server-side
- Verify file type by content (not just extension)
- Scan for malware if accepting from public users
- Use secure, unique filenames when storing
- Store files outside web root when possible
Limitations
File input limitations to be aware of:
- Maximum size is controlled by your backend configuration
- Browser may have upload size limits
- Mobile devices may have different file picker UIs
- File validation happens both client and server-side
Return Value
Returns a string containing the Forms.md markup for the file input field. Submitted value:- With Google Sheets: URL to the file in Google Drive
- Custom backend: File object in multipart/form-data
Related Methods
textInput
Text input for file URLs or references
pictureChoice
Choose from predefined images