Home
> Canvas Apps > Canvas App | Attachments | File Size and File Type validations
Canvas App | Attachments | File Size and File Type validations
Have you ever got “File to large” error while using Attachments control, something as below.
In this short article lets understand how to configure the size limits and also File Type validation
Steps to set the ‘MaxAttachmentSize’ for the ‘Attachments’ control:
MaxAttachmentSize property limits the maximum allowed file size in MB of each new attachment. So we need to set this property as shown below.
- Open the Canvas App and select the Attachments card.
- From the Properties set the ‘Maximum attachment size (in MB)’ to desired limit.
- Save and Publish
Validate attached file by file type:
- If you need your Attachments control to accepts certain file type(s), add validation logic on OnAddFile event of Attachments control.
- Formula to validate single file type (i.e., .msapp):
If(
Not(
EndsWith(
First(Self.Attachments).Name,
".msapp"
)
),
Notify(
"Only a MSAPP File (.msapp) is allowed.",
NotificationType.Error
);
// Clear the attached file
Reset(Self)
)
- Formula to validate multiple file types (i.e., msapp and zip):
If(
Not(
EndsWith(
First(Self.Attachments).Name,
".msapp"
)
) And Not(
EndsWith(
First(Self.Attachments).Name,
".zip"
)
),
Notify(
"Either a MSAPP File (.msapp) or Zip File (.zip) is allowed.",
NotificationType.Error
);
// Clear the attached file
Reset(Self)
)
Notes:
- The attachment control has these limitations:
- The attachment control only supports lists and Dataverse tables as the data sources.
- Attachments control on a web browser lets you select multiple files, However, when using attachments control on Power Apps Mobile, you can only add files one at a time.
- MaxAttachments property limits the maximum number of files the control will accept.
🙂
Categories: Canvas Apps
Tags: Attachments, MaxAttachmentSize
Leave a comment Cancel reply
Stats
- 1,777,660 hits
Join 431 other subscribers
Top Posts
- C# - SQL - Bulk Insert records from Data Table and CSV
- Power Apps component framework (PCF) - Beginner guide
- Canvas App | Power automate | Read and preview Dataverse 'File' column content
- [Step by Step] Model-driven apps | In-app notifications
- Canvas App | Attachments | File Size and File Type validations
- C# - Bulk Update Records - Pass Data Table to SQL Stored Procedure
- [Code Snippet] | C# | Connecting to Dataverse using both Service Principal and User IDs
- Dynamics Portals - Customize OOB 'Entity List' grid
- Canvas App | Get Environment ID without the need of cloud flow
- C# | Running web api project locally | 'Your connection isn't private' warning
Hi,
I’m trying to use an attachment control in mobile but I can’t add video files, is that a limitation of the control? I can add videos on browser without issue.