File Data Type

Version: Available or changed with runtime version 1.0.

Represents a file.

Static methods

The following methods are available on the File data type.

Method name Description
Copy(Text, Text) Copies a file.
Download(Text, Text, Text, Text, var Text) Sends a file from a server computer to the client computer. The client computer is the computer that is running the Windows client or the computer that is running a browser that accesses the web client.
DownloadFromStream(InStream, Text, Text, Text, var Text) Sends a file from server computer to the client computer. The client computer is the computer that is running the Windows client or the computer that is running the browser that accesses the web client.
Erase(Text) Deletes a file.
Exists(Text) Determines whether a file exists.
GetStamp(Text, var Date [, var Time]) Gets the exact time that a file was last written to.
IsPathTemporary(Text) Validates whether the given path is located in the current users temporary folder within the current service.
Rename(Text, Text) Renames an ASCII or binary file.
SetStamp(Text, Date [, Time]) Sets a timestamp for a file.
Upload(Text, Text, Text, Text, var Text) Sends a file from the client computer to the server computer. The client computer is the computer that is running the Windows client or the computer that is running a browser that accesses the web client.
UploadIntoStream(Text, Text, Text, var Text, var InStream) Sends a file from the client computer to the corresponding server. The client computer is the computer that is running the Windows client or the computer that is running a browser that accesses the web client.
UploadIntoStream(Text, var InStream) 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.

Instance methods

The following methods are available on instances of the File data type.

Method name Description
Close() Closes a file that has been opened by the OPEN method (File).
Create(Text [, TextEncoding]) Creates an Automation object.
CreateInStream(InStream) Creates an InStream object for a file. This enables you to import or read data from the file.
CreateOutStream(OutStream) Creates an OutStream object for a file. This enables you to export or write data to the file.
CreateTempFile([TextEncoding]) Creates a temporary file. This enables you to save data of any format to a temporary file. This file has a unique name and will be stored in a temporary file folder.
Len() Gets the length of an ASCII or binary file.
Name() Gets the name of an ASCII or binary file.
Open(Text [, TextEncoding]) Opens an ASCII or binary file. This method does not create the file if it does not exist.
Pos() Gets the current position of the file pointer in an ASCII or binary file.
Read(var Any) Reads from an MS-DOS encoded file or binary file.
Seek(Integer) Sets a file pointer to a new position in an ASCII or binary file.
TextMode([Boolean]) Sets whether a file should be opened as an ASCII file or a binary file. Gets the current setting of this option for a file.
Trunc() Truncate an ASCII or binary file to the current position of the file pointer.
Write(Boolean) Writes to an MS-DOS encoded file or binary file.
Write(Byte) Writes to an MS-DOS encoded file or binary file.
Write(Char) Writes to an MS-DOS encoded file or binary file.
Write(Integer) Writes to an MS-DOS encoded file or binary file.
Write(BigInteger) Writes to an MS-DOS encoded file or binary file.
Write(Decimal) Writes to an MS-DOS encoded file or binary file.
Write(Guid) Writes to an MS-DOS encoded file or binary file.
Write(Text) Writes to an MS-DOS encoded file or binary file.
Write(Code) Writes to an MS-DOS encoded file or binary file.
Write(Label) Writes to an MS-DOS encoded file or binary file.
Write(BigText) Writes to an MS-DOS encoded file or binary file.
Write(Date) Writes to an MS-DOS encoded file or binary file.
Write(Time) Writes to an MS-DOS encoded file or binary file.
Write(DateTime) Writes to an MS-DOS encoded file or binary file.
Write(DateFormula) Writes to an MS-DOS encoded file or binary file.
Write(Duration) Writes to an MS-DOS encoded file or binary file.
Write(Option) Writes to an MS-DOS encoded file or binary file.
Write(Record) Writes to an MS-DOS encoded file or binary file.
Write(RecordId) Writes to an MS-DOS encoded file or binary file.
Write(Text) Writes to an MS-DOS encoded file or binary file.
Write(Any) Writes to an MS-DOS encoded file or binary file.
WriteMode([Boolean]) Use this method before you use OPEN method (File)] to set or test whether you can write to a file in later calls.

See Also

Get Started with AL
Developing Extensions