Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

User should only be allowed to upload PNG files to picture field

(1) ShareShare
ReportReport
Posted on by 30

Hello guys,

how can I force the user to only upload images in the BLOB field if it is a PNG file?

Do you have an idea how I can achieve this?

Thank you.

  • Maddin Profile Picture
    Maddin 30 on at
    RE: User should only be allowed to upload PNG files to picture field

    Hello,

    thank you very much for your help.

    Meanwhile I have created some code, that ensures that the user can only upload images of type PNG. But the problem here is that I use the data type Blob as field and if you click on the field in the page to upload an image, the default logic comes here. As soon as one apparently deposits a field of the type Blob and of the subtype Bitmap, standard functions are always run through. Only after I have then uploaded an image via the standard, next comes my window with the upload only for PNG images. Can I switch off the standard logic somehow? My logic is always later...my code is passed through, in the OnValidate trigger of the new field "Image".

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,848 Super User 2024 Season 2 on at
    RE: User should only be allowed to upload PNG files to picture field

    Hi, I think what Inge means is that when you upload a file, judge whether it is a PNG from the File Name, and if it is not, an error will be prompted.
    Of course this requires customization, not a standard feature.

    For example,

    pastedimage1681875880601v1.png

    Hope this helps.

    Thanks.

    ZHU

  • Maddin Profile Picture
    Maddin 30 on at
    RE: User should only be allowed to upload PNG files to picture field

    Ok, the table is 156 and the page 76. Where should I test this?

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 993 Super User 2024 Season 1 on at
    RE: User should only be allowed to upload PNG files to picture field

    I guess the easiest way will be do a check on the filename that the user is trying to upload.

    But the actual code will depend on what table / page you are working on.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans