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.
🙂
Advertisement
Categories: Canvas Apps
Tags: Attachments, MaxAttachmentSize
Comments (0)
Trackbacks (0)
Leave a comment
Trackback
Stats
- 1,608,377 hits
Join 408 other subscribers
Top Posts
- Power Apps component framework (PCF) - Beginner guide
- [Step by Step] Power Apps | Show pop ups in Canvas App
- Power Automate Cloud Flow | 'Correct to include a valid reference' error
- [Step by Step] Canvas App | Dataverse | Filter, Patch, For All, Lookup
- [Step by Step] Embed "Azure Blob" connector Canvas App in Model Driven App
- [Step by Step] Power Apps Portal - Configure Global Search
- Power Platform CLI | Pack and Unpack solution using map xml
- Wait Condition with 'Parallel Wait Branch'
- Power Apps - Component library
- C# - SQL - Bulk Insert records from Data Table and CSV