Partager via


UPLOADINTOSTREAM Function (File)

Sends a file from the client computer to the corresponding Microsoft Dynamics NAV Server. The client computer is the computer that is running the Microsoft Dynamics NAV Windows client or the computer that is running a browser that accesses the Microsoft Dynamics NAV Web client.

Syntax

  
[Ok :=] UPLOADINTOSTREAM(DialogTitle, FromFolder, FromFilter, FromFile, NVInStream)  

Parameters

DialogTitle
Type: Text

The text displayed in the title bar of the Open dialog box.

Note

This parameter is not supported by the Microsoft Dynamics NAV Web client. The title is determined by the end-user's browser.

FromFolder
Type: Text

The path of the folder that is displayed in the File Open dialog box. This is the default folder, but the user can browse to any available location.

Note

This parameter is not supported by the Microsoft Dynamics NAV Web client. By default, the browser uses the folder that was last accessed.

FromFilter
Type: Text

The type of file that can be uploaded to Microsoft Dynamics NAV Server.

In the Microsoft Dynamics NAV Windows client, the type is displayed in the upload dialog box, so the user can only select files of the specified type. For the Microsoft Dynamics NAV Web client, a user can try to upload any file type but an error occurs if the file is not the specified type.

FromFile
Type: Text

The default file to upload to the Dynamics NAV service. The name displays in the dialog box for uploading the file. The user can change the file.

Note

This parameter is not supported by the Microsoft Dynamics NAV Web client.

NVInStream
Type: Variant

The InStream that is used to send the file.

Property Value/Return Value

Type: Boolean

If you omit this optional return value, then a run-time error occurs if the record cannot be found. If you include a return value, then you must handle any errors.

true if the file was uploaded; otherwise, false.

Remarks

Note

This function is not supported by the Microsoft Dynamics NAV Web client on devices that run Apple iOS, such as iPad. The dialog box for uploading a file displays in the Microsoft Dynamics NAV Web client, but it is disabled and the user cannot select a file.

The maximum size of the file to be uploaded is specified by the MaxUploadSize setting in the CustomSettings.config file. The setting is specified in megabytes. For more information, see Configuring Microsoft Dynamics NAV Server.

In Dynamics NAV, the business logic runs on the computer that is running Microsoft Dynamics NAV Server and not on the client. Files are created on Microsoft Dynamics NAV Server and not locally on the client computer.

Use UPLOAD Function (File) and UPLOADINTOSTREAM Function (FILE) to send a file from the client to Microsoft Dynamics NAV Server.

Use DOWNLOAD Function (File) and DOWNLOADFROMSTREAM Function (File) to send a file from Microsoft Dynamics NAV Server to the client.

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

Example

This example requires that you create the following variables.

Name DataType
FileName Text
NVInStream InStream
FileName := 'c:\SomeFile.txt';  
UPLOADINTOSTREAM('Import','',' All Files (*.*)|*.*',FileName,NVInStream);  

See Also

File Data Type
Walkthrough: Uploading a File from a Client to Microsoft Dynamics NAV Server