Discuss this help topic in SecureBlackbox Forum

TElSftpClient.OpenFile

TElSftpClient     See also     


Filter: C#/Java  VB.NET  Pascal  C++  PHP  


Opens a file on the server.

Declaration

[C#/Java]
    bool OpenFile(string Filename, TSBSftpFileOpenModes Modes, TElSftpFileAttributes Attributes);
    bool OpenFile(string Filename, TSBSftpFileOpenModes Modes, int Access, TElSftpFileAttributes Attributes);

[VB.NET]
    Function OpenFile(ByVal Filename As String, ByVal Modes As TSBSftpFileOpenModes, ByVal Attributes As TElSftpFileAttributes) As Boolean
    Function OpenFile(ByVal Filename As String, ByVal Modes As TSBSftpFileOpenModes, ByVal Access As Integer, ByVal Attributes As TElSftpFileAttributes) As Boolean

[Pascal]
    function OpenFile(Filename : string; Modes : TSBSftpFileOpenModes; Attributes : TElSftpFileAttributes) : boolean;
    function OpenFile(const Filename : string; Modes : TSBSftpFileOpenModes; Access : TSBSftpFileOpenAccess; Attributes : TElSftpFileAttributes): boolean;
    function OpenFileSync(const Filename : string; Modes : TSBSftpFileOpenModes; Attributes : TElSftpFileAttributes) : TSBSftpFileHandle;
    function OpenFileSync(const Filename : string; Modes : TSBSftpFileOpenModes; Access : TSBSftpFileOpenAccess; Attributes : TElSftpFileAttributes) : TSBSftpFileHandle;
    type TSBSftpFileHandle = ByteArray;
    TSBSftpFileOpenModes = set of TSBSftpFileOpenMode;
    TSBSftpFileOpenAccess = set of TSBSftpFileOpenAccessItem;

[C++]
    bool OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TElSftpFileAttributes &Attributes);
    bool OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TElSftpFileAttributes *Attributes);
    bool OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TSBSftpFileOpenAccess Access, TElSftpFileAttributes &Attributes);
    bool OpenFile(const std::string &Filename, TSBSftpFileOpenModes Modes, TSBSftpFileOpenAccess Access, TElSftpFileAttributes *Attributes);

[PHP]
    bool OpenFile(string $Filename, integer $Modes, TElSftpFileAttributes $Attributes)
    bool OpenFile(string $Filename, integer $Modes, integer $Access, TElSftpFileAttributes $Attributes)

Parameters

  • Filename - the name of the file to be opened.
  • Modes - specifies the file opening modes.
  • Attributes - specifies the initial attributes for the file.
  • Access - specifies if file must be blocked for reading, writing, or deleting while opened.

TSBSftpFileOpenMode values:


TSBSftpFileOpenAccessItem values:


TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenAccess values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

TSBSftpFileOpenModes values

Return value

    OpenFile returns True if the operation was completed successfully, and False otherwise.
    OpenFileSync returns a handle to the opened file.

Description

    Use OpenFile to open files on a server side in asynchronous mode, and OpenFileSync to open files in synchronous mode. If the file was successfully opened, the OnOpenFile event is fired. The OnError event is fired otherwise.

    The file is opened in binary mode, unless fmText flag is included to Modes parameter.

    After you have finished using the directory, close the handle with a call to CloseHandle() method.


    Note, the Access parameter has sense only for SFTPv5 and will be ignored for earlier versions.
    Note, setting of file opening mode differs for VCL and .NET versions. To enable several modes in .NET use bitwise OR operation, for example "fmRead | fmWrite | fmAppend".

See also:     CloseHandle     CreateFile     OpenStream     RemoveFile     Read     Write    

Discuss this help topic in SecureBlackbox Forum