Back to product page

AddData method

Adds new virtual file from the byte array.


  • Basic
object.AddData RelativePath, Name, DataArray()
The AddData(object,RelativePath,Name,DataArray()) syntax has these parts:
objectAn expression evaluating to an object of type VirtualFiles.
RelativePathRequired. A String value. Holds path where virtual file appears (may contain wildcards).
NameRequired. A String value. Holds name of virtual file.
DataArray()Required. An array of Byte values. Holds raw file data.


AddData method will add new virtual file to the collection - for the User or globally for the server. Adding new virtual files for the server - through wodFTPD.VirtualFiles property will affect only new users that connect - any users currently online will not see new file until they reconnect. To add new virtual file to existing (currently connected) users, use User.VirtualFiles collection.

Temporary file will be created in your temporary folder (typically in "Documents and Settings") where will contents of your DataArray be placed - and then ResolvedPath will be pointed to this temporary file.

For example, to add virtual file for all new users that will be visible in their root path, you can do this:
Dim b(10) As Byte
b(10) = 10
wodFtpD1.VirtualFiles.AddData "/", "testfile", b

Users will see virtual files just as they really exist in your filesystem - they will not know the difference.