File Data Type

Represents a file.

The following methods are available on the File data type.

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

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

Method name Description
Open(String [, TextEncoding]) Opens an ASCII or binary file. This method does not create the file if it does not exist.
Create(String [, TextEncoding]) Creates an Automation object.
Close() Closes a file that has been opened by the OPEN method (File).
Name() Gets the name of an ASCII or binary file.
Pos() Gets the current position of the file pointer in an ASCII or binary file.
Len() Gets the length of an ASCII or binary file.
Read(var Any) Reads from an MS-DOS encoded file or binary file.
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(String) Writes to an MS-DOS encoded file or binary file.
Write(Any) Writes to an MS-DOS encoded file or binary file.
Seek(Integer) Sets a file pointer to a new position in an ASCII or binary file.
Trunc() Truncate an ASCII or binary file to the current position of the file pointer.
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.
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.
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.

See Also

Getting Started with AL
Developing Extensions