WriteFile Event
This event is fired when a file write request is received.
Syntax
public event OnWriteFileHandler OnWriteFile; public delegate void OnWriteFileHandler(object sender, SftpserverWriteFileEventArgs e); public class SftpserverWriteFileEventArgs : EventArgs { public long ConnectionID { get; } public string Handle { get; } public int Offset { get; } public int OperationStatus { get; set; } }
Public Event OnWriteFile As OnWriteFileHandler Public Delegate Sub OnWriteFileHandler(sender As Object, e As SftpserverWriteFileEventArgs) Public Class SftpserverWriteFileEventArgs Inherits EventArgs Public ReadOnly Property ConnectionID As Long Public ReadOnly Property Handle As String Public ReadOnly Property Offset As Integer Public Property OperationStatus As Integer End Class
Remarks
This event is fired when a request to write a data block to a file is received from the client. The ConnectionID parameter specifies the session the request originates from. The Handle parameter references the opened file where the block should be written to. Offset references the position in the file where the block of data should be written.
Use GetClientBuffer method to obtain the piece of data that should be written to the file.
Set OperationStatus to one of the below values according to the outcome of the request processing:
ostOk | 1 | |
ostNoSuchFile | 2 | |
ostAccessDenied | 3 | |
ostWriteProtect | 4 | |
ostUnsupported | 5 | |
ostInvalidParameter | 6 | |
ostEOF | 7 |