Back to product page

AddFile method


Adds new virtual file.

Syntax

  • Basic
object.AddFile RelativePath, Name, ResolvedPath
The AddFile(object,RelativePath,Name,ResolvedPath) 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.
ResolvedPathRequired. A String value. Holds full path where virtual file resolves.

Remarks

AddFile 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.

For example, to add virtual file for all new users that will be visible in their root path, you can do this:
 
FtpD.VirtualFiles.AddFile "/", "testfile.txt", "F:\latest_test_data.txt"
 

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

Platforms

Windows