function OpenFile(const FileName: string; Modes: TScSFTPFileOpenModes; Attributes: TScSFTPFileAttributes = nil): TScSFTPFileHandle; overload;

function OpenFile(const FileName: string; Mode: TScSFTPFileOpenMode; Flags: TScSFTPFileOpenFlags = []; BlockModes: TScSFTPBlockModes = []; Access: TScSFTPDesiredAccess = []; Attributes: TScSFTPFileAttributes = nil): TScSFTPFileHandle; overload;



Call the OpenFile method to open or create a remote file.

If the NonBlocking property is set to False, OpenFile returns file handle. Otherwise it returns nil, and to receive the file handle the OnOpenFile event should be processed. If the server returns an error, the OnError event is generated.

The file handle that was received may be used in other operations like ReadFile, WriteFile etc. After the work with the file handle was finished, you should close it by calling the CloseHandle method.



FileName - the name of the file that is being opened. If FileName is the name of a directory, an error will be raised.
Modes - flags for the file opening (refer to TScSFTPFileOpenModes).
Mode - the mode of the file opening (refer to TScSFTPFileOpenMode).
Flags - the set of flags for the file opening (refer to TScSFTPFileOpenFlags).
BlockModes - the blocking mode of the file that is being opened (refer to TScSFTPBlockModes).
Access - the rights for the file access that are a combination of values of the ace-mask flags (refer to TScSFTPDesiredAccess). If the server cannot grant the access desired, it returns the SSH_FX_PERMISSION_DENIED error.
Attributes - specifies the initial attributes for the file. Parameter is ignored if an existing file is opened.


Note: It is preferable to use the first overload method with the version 4 of the SFTP protocol or lower, and the second - with the version 5 or higher (that's why it has more parameters, and, as a result, has enhanced functionality).


See Also











SecureBridge Components, Copyright © 2007-2021 Devart. All Rights Reserved. Provide Feedback Visit Forum Request Support