web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to limit the size ...
Power Apps
Answered

How to limit the size of image in add picture control to less than 2 MB ?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

We are having 4 Add picture control in our powerapp . We have written a flow which contains "Send an email with options" . The send an email option is not allowing to attach more than 2 MB of attachment . So we are trying to limit the upload to 2 MB . Is there any way to do it . Kindly help

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @Anonymous , This is a bit left-field, but it will work for you. On the OnChange property of your AddMediaButton (replace with your control name and also do the same for UploadedImage1 below)

    Set(vImg,JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData))
    If(
     Len(vImg) > 1460000,
     "Image size " too big",
     <whatever you are doing now>
    )

    You can also put a label on top of the image control

    Text(Len(vImg)*.00000073,"[$-en-US]##.##") & " Mb"

    to show the size as soon as it is uploaded.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks a lot @WarrenBelz . It worked like a charm.

  • CMOLINAV Profile Picture
    108 on at

    Hello Warren,

     

    Why 1460000?

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @CMOLINAV ,

    That is the approximate size of 2mb file converted to Base64 Text with JSON.

  • LW-28112008-0 Profile Picture
    on at

    @WarrenBelz , how could I calculate the size for 4Mb image as base64 text JSON?

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @LukePWilkins ,

    It should be double the figure mentioned.

  • LW-28112008-0 Profile Picture
    on at

    Thank you @WarrenBelz 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    What is the maximum Size limit of the Image  to upload

  • michaeldanieal Profile Picture
    on at

    Hi, Is there a way to restrict the image format. Such as 'allow only .jpg or .jpeg' and show error when image of other formats are uploaded. Thanks in advance

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @michaeldanieal ,

    OnAddFile of the Attachment Control

    If(
     Last(
     Split(
     Last(Self.Attachments).Name,
     "."
     )
     ).Value in [
     "jpg",
     "jpeg"
     ],
     true,
     Reset(Self);
     Notify(
     "Only attach JPG or JPEG files",
     NotificationType.Error
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard