Back to product page

FileTransferData method


Called during file transfer, allowing you to alter file contents.

Type

None

Syntax

  • Basic
object.FileTransferData Owner, FileData()
The FileTransferData(object,Owner,FileData) syntax has these parts:
objectAn expression evaluating to an object of type IwodFtpNotify.
OwnerRequired. A wodFtpDLXCom object.
FileDataAn array of Byte values. Actual data as byte array (SAFEARRAY(unsigned char *) for VC++ users).

Remarks

This method is called only if you implemented IwodFtpNotify interface in your application, and wodFtpDLX.Notification property has received reference to instance of your implementation.

FileTransferData notification method is called during file transfers when LocalPath property (and LocalPath argument in GetFile or PutFile methods) isn't set, or is set to "" (empty string). In such cases, GetFile and PutFile methods will not open local file for reading/writing, instead they will call this notification method allowing you to read/write data from remote file from/to byte array.

Since FileData argument is a byte array, file contents can be changed in size and in values - you can supply new byte array to this argument if needed. For example, following code will always destroy all values in the array, and no matter how large files user tries to upload (or download), it will always end up with zero sized file:
 
Private Sub IwodFtpNotify_FileTransferData(ByVal Owner As wodFtpDLXComLib.IwodFtpDLXCom, FileData() As Byte)
 Dim b() As Byte
 DirData = b
End Sub
 

For downloads: In order to determine exactly how many bytes are in FileData array, you should calculate it like this (VB example): UBound(FileData) - LBound(FileData) + 1

Remember that FileData(0) is the first element in the array.

For uploads: to create new byte array and put some data inside, so it is transferred to remote side, you can use code similar to this (VB example):
 
Private Sub IwodFtpNotify_FileTransferData(ByVal Owner As wodFtpDLXComLib.IwodFtpDLXCom, FileData() As Byte)
  Dim a As String
  a = "some text"
  ReDim FileData(Len(a) - 1)
 
  Dim i As Integer
  For i = 0 To Len(a) - 1
     FileData(i) = Asc(Mid$(a, i + 1, 1))
  Next i
Exit Sub
 


Platforms

Windows