Handle multiple file uploads and file drop zones
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.
Important
Some of the functionality described in this release plan has not been released. Delivery timelines may change and projected functionality may not be released (see Microsoft policy). Learn more: What's new and planned
Enabled for | Public preview | General availability |
---|---|---|
Users, automatically | Mar 4, 2024 | May 2024 |
Business value
The ability for AL developers to handle multiple file uploads and designate different page parts as file drop zones 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 and designate different page parts as file drop zones.
This improvement empowers AL developers to create more flexible and user-friendly interfaces within Business Central. Designating specific page parts as file drop zones lets people 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. By allowing users to drag and drop files onto designated page parts, developers can streamline the file upload process and simplify data entry.
The following example designates a group and field as file drop zones by referencing the ProductImageUpload action in the FileUploadAction property. 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 drag to a drop zone. After you drag one or more files to a group or field on a HappyDragAndDrop page, the OnAction trigger in the FileUploadAction property is called with the list of files.
> page 50102 HappyDragAnddropPage
> {
> PageType = Card;
> SourceTable = item;
> UsageCategory = Administration;
>
> layout
> {
> area(Content)
> {
> group(GroupName)
> {
> FileUploadAction = ProductImageUpload;
>
> field(name; 'Name')
> {
> FileUploadAction = ProductImageUpload;
> }
> }
> }
> }
>
> actions
> {
> area(Processing)
> {
> fileUploadAction(ProductImageUpload)
> {
> Caption = 'Upload product Image';
>
> AllowMultipleFiles = false;
> AllowedFileExtensions = '.jpg', '.jpeg', '.png';
>
> trigger OnAction(files: List of [FileInfo])
> var
> currentFile: FileInfo;
> stream: InStream;
> begin
> foreach currentFile in files do begin
> currentFile.CreateInStream(stream);
> // Code here to handle the file
> Message('%1 has a length of %2', currentFile.FileName, stream.Length);
> end;
> end;
> }
> }
> }
> }
Note
You can start adding support for multiple file uploads in your apps to have File Upload Dialog support multiple files. This related release plan, Use drag and drop to attach multiple files, will bring in support for this in Base Application in upcoming minor updates.
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.