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
Comments (0)
Trackbacks (0)
Leave a comment
Trackback
Stats
- 1,556,673 hits
Tweets
- RT @ManuelaPichler_: I suffered a concussion last week, and I'm so glad to see this video is actually REAL and not just something my brain… 3 hours ago
- RT @TaikiYoshidaEN: Awesome to see we have a shiny new public facing website for Power CAT! 😻😻😻 microsoft.github.io/powercat/ #PowerApps #PowerA… 4 days ago
- RT @ravichada: 🎥 The demo video is ready now. Do check out the Dataverse Security Roles risk assessment tool in action. Leave a comment or… 4 days ago
- RT @ManuelaPichler_: CoE kit but make it more fluent-y #comingsoon https://t.co/kcSzPqwZhM 4 days ago
- New Blog Post: C# Basics | Why Interfaces rajeevpentyala.com/2023/01/07/c-b… 3 weeks ago
Join 400 other subscribers
Top Posts
- Power Apps component framework (PCF) - Beginner guide
- [Code Snippet] Custom Workflow Activity with Input and Output Params
- Auto generate new GUID for ‘uniqueidentifier’ column in SQL Table
- Power Apps - 'Environment Variables' and their usage in Canvas Apps
- Azure DevOps (ADO) | Pipeline failure | You need the Git 'GenericContribute' permission
- [Step by Step] Power Apps Portal - Configure Global Search
- Associate/Disassociate plugin messages in CRM
- [Step by Step] Connecting to Azure SQL Server using OLEDB Connection from SSIS
- Canvas App Import Failure | CanvasAppEnvironmentMismatch error
- C# - SQL - Bulk Insert records from Data Table and CSV