Compartilhar via


UPLOAD Function (File)

Sends a file from the client computer to the Microsoft Dynamics NAV Server computer. 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.

[Ok :=] UPLOAD(DialogTitle, FromFolder, FromFilter, FromFile, ToFile)

Parameters

  • DialogTitle
    Type: Text The title that you want to display in the dialog box for uploading the file.

    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 name of the folder that is displayed in the dialog box. This is the default value, and the user can change it.

    Note

    This parameter is not supported by the Microsoft Dynamics NAV Web client. 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 that 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 that you want to upload to the Microsoft 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.

  • ToFile
    Type: Variant The path and file name to give the uploaded file. If you do not provide a path, or you upload the file that uses Microsoft Dynamics NAV Web client, then the file is uploaded to the following folder on the computing that is running Microsoft Dynamics NAV Server: \ProgramData\Microsoft\Microsoft Dynamics NAV\80\Server\MicrosoftDynamicsNAVServer$DynamicsNAV80\users\ServiceAccount ServiceAccount is the folder for the account for Microsoft Dynamics NAV Server.

Property Value/Return Value

Type: Boolean

If you omit this optional return value, then a run-time error occurs if the file 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.

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

UPLOAD Function (File) and UPLOADINTOSTREAM Function (File) are used to send a file from the client to a Microsoft Dynamics NAV service.

DOWNLOAD Function (File) and DOWNLOADFROMSTREAM Function (File) are used to send a file from a Microsoft Dynamics NAV service to the client.

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

Example

UPLOAD('Upload file','C:\','Text file(*.txt)|*.txt','Test.txt',varTest)

See Also

Reference

File Data Type