File Operations
Momen supports file-related actions on Web and Native App, including upload, view, download, and bitmap export.
File actions include:
- Upload File
- View File
- Download File
- Download Bitmap
Upload File
Overview
Upload a local file to the server. Supported formats include PDF, Word, Excel, audio, and video.
- File selection: Let users pick a file from their device
- Format support: Common document, audio, and video types
- Data storage: Save the result to a page variable or database
- Status feedback: Use success/failure actions for user feedback
- Business integration: Combine with form submission workflows
Platform differences:
| Platform | Behavior |
|---|---|
| Web | Pick files from the system file picker; supports a wide range of formats |
| Native App | Pick files from the device file system |
Configuration
| Parameter | Required | Description |
|---|---|---|
| Target page variable | Yes | File-type page variable to store the upload result |
| File size limit | No | Maximum file size (platform defaults apply) |
| On success | No | Actions after a successful upload (toast, database save, navigation) |
| On failure | No | Actions after a failed upload (error toast, retry) |
Output
| Field | Description |
|---|---|
| File info | File object with name, size, type, URL, etc., stored in the page variable |
| Upload status | true (success) or false (failure) |
Notes
- Add a File page variable before configuring the action.
- Only one file per upload; a new upload overwrites the previous file.
- File preview is not supported during upload.
Examples
Resume upload
Trigger: Upload resume button
Target page variable: resume_file
On success:
1. Show toast "Resume uploaded"
2. Save to database via data mutation
3. Update page state
On failure: Show toast "Upload failed — please retry"Contract upload
Trigger: Upload contract button
Target page variable: contract_file
On success:
1. Show toast "Contract uploaded"
2. Enable submit button
3. Save file info to form data
On failure: Show error and allow retryPlatform Support
- Web
- Native App
View File
Overview
Open and preview file content in the app. Supports PDF, Word, Excel, images, and other common formats.
- Preview: View files inside the app
- Local files: View files stored in page variables
- Remote files: View files from database records via page data
Configuration
| Parameter | Required | Description |
|---|---|---|
| File source | Yes | Local upload (page variable) or File (database record) |
| File data | Yes | Page variable or page data field binding |
| File name | No | Custom display name |
Output
No direct output. The action opens a file viewer.
Prerequisites
- To view database files, configure the relevant page data source.
- File size should not exceed 20 MB.
Examples
View uploaded resume
Trigger: View resume button
File source: Local upload
File data: resume_file page variableView stored document
Trigger: View button in document list
File source: File
File data: document field from page dataPlatform Support
- Native App
Download File
Overview
Download a file stored in the database to the user’s local device.
Configuration
| Parameter | Required | Description |
|---|---|---|
| File data source | Yes | Page data field binding to a file column |
| Download file name | No | Custom filename (defaults to original name) |
Output
No direct output. Triggers the browser or system download.
Prerequisites
Configure a page data source that queries the file record.
Examples
Download report
Trigger: Download report button
File data source: report_file from page data
Download file name: "{report_name}_{date}.pdf"Download contract
Trigger: Download contract button
File data source: contract document fieldPlatform Support
- Web
Download Bitmap
Overview
Convert a specified view region on the page into an image and download it locally.
- View to image: Export a container or section as a bitmap
- Content export: Capture complex layouts as images
- Sharing: Generate images for social sharing or records
Configuration
| Parameter | Required | Description |
|---|---|---|
| Target view component | Yes | Container component to convert |
| Image format | No | PNG, JPEG, etc. (default: PNG) |
| Image quality | No | Number 0–1 (default: 1.0) |
| Download file name | No | Custom filename |
Output
| Field | Description |
|---|---|
| Bitmap data | Generated image for download or further use |
| Conversion status | true (success) or false (failure) |
Workflow
To download a view as an image:
- Add Component Operations → View → View to Image and specify the target view component ID.
- On success, add File Operations → Image → Download Bitmap and bind the result data.
Examples
Page screenshot
Step 1: View to Image
Target: Main page container
Format: PNG
Step 2: Download Bitmap
Trigger: Download screenshot button
Bitmap data: Conversion result
File name: screenshot_{timestamp}.pngShare card
Step 1: View to Image
Target: Share card container
Format: JPEG
Quality: 0.8
Step 2: Download Bitmap
Bitmap data: Conversion result
Purpose: Generate a shareable card imagePlatform Support
- Web
Notes
The target view must be fully loaded before conversion for accurate results.