Düzenle

Aracılığıyla paylaş


File.UploadIntoStream(Text, var InStream) Method

Version: Available or changed with runtime version 7.0.

Sends a file from the client computer to the corresponding server. The client computer is the computer that is running a browser that accesses the web client.

Syntax

[Ok := ]  File.UploadIntoStream(FromFilter: Text, var InStream: InStream)

Note

This method can be invoked without specifying the data type name.

Parameters

FromFilter
 Type: Text
The type of file that can be uploaded to the server. A user can try to upload any file type but an error occurs if the file is not the specified type.

InStream
 Type: InStream

Return Value

[Optional] Ok
 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

Note

This method is not supported on devices that run Apple iOS, such as iPad. The dialog box for uploading a file displays, but it is turned off and the user cannot select a file.

The business logic runs on the Dynamics 365 Business Central service and not on the client. Files are created on Dynamics 365 Business Central service and not locally on the client computer.

Use Upload Method (File) and UploadIntoStream Method (File) to send a file from the client to the Dynamics 365 Business Central service.

Use Download Method (File) and DownloadFromStream Method (File) to send a file from the Dynamics 365 Business Central service to the client.

We recommend that you use the methods in codeunit 419, File Management, to upload and download files.

Example

The FromFilter parameter must follow this pattern: <ExtensionGroupName>|<extension1>;<extension2>, for example 'Word files|*.docx;*.doc'.

codeunit 50100 MyCodeunit
{

    procedure MyProcedure()
    var
        FromFilter: Text;
        NVInStream: InStream;
    begin
        FromFilter := 'All Files (*.*)|*.*';
        UploadIntoStream(FromFilter, NVInStream);
    end;

}

File Data Type Get Started with AL Developing Extensions