Handle multiple file uploads

Important

This content is archived and is not being updated. For the latest documentation, go to What's new or changed in Business Central. For the latest release plans, go to Dynamics 365, Power Platform, and Cloud for Industry release plans.

Enabled for Public preview General availability
Users, automatically Apr 5, 2024 -

Business value

The ability for AL developers to handle multiple file uploads in Business Central provides greater flexibility and usability. This enhancement benefits developers working on applications or customizations that require multifile upload functionality and adds value to organizations by improving productivity and the user experience.

Feature details

Developers can handle multiple file uploads. This improvement empowers AL developers to create more flexible and user-friendly interfaces within Business Central. Designating specific actions allows users to upload multiple files at the same time, which improves efficiency.

This feature is particularly valuable for developers working on applications or customizations that require users to upload multiple files simultaneously.

The FileUploadAction action's AllowMultipleFiles property lets developers specify whether an action can handle a single file, or multiple files. The AllowedFileExtensions property allows developers to specify the file types that people can upload. OnAction trigger in the FileUploadAction property is called with the list of files.

page 50102 HappyMultiFileUploadPage
{
    PageType = Card;
    SourceTable = Item;
    UsageCategory = Administration;

    layout
    {
        area(content)
        {
        }
    }

    actions
    {
        area(Processing)
        {
            fileuploadaction(ProductImageUpload)
            {
                Caption = 'Upload product image';
                AllowMultipleFiles = true;
                AllowedFileExtensions = '.jpg', '.jpeg', '.png';
                trigger OnAction(Files: List of [FileUpload])
                var
                    CurrentFile: FileUpload;
                    TempInStream: InStream;
                begin
                    foreach CurrentFile in Files do begin
                        CurrentFile.CreateInStream(TempInStream, TEXTENCODING::UTF8);
                        // Code here to handle the file
                        Message('%1 has a length of %2', CurrentFile.FileName, TempInStream.Length)
                    end;
                end;
            }
        }
    }
}

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.