CreateFile Method  
 

Create a file on the server.

Syntax

object.CreateFile( FileName, FileLength )

Parameters

FileName
A string which specifies the name of the file being created on the server. The client must have the appropriate access rights to create the file or an error will be returned.
FileLength
A number which specifies the size of the file in bytes. This value must be greater than zero.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

Remarks

The CreateFile method uses the PUT command to create the file. The server must support this command and the user must have the appropriate permission to create the specified file. If this method is successful, the client should then use the Write method to send the contents of the file to the server. Once all of the data has been written, the CloseFile method should be called to close the file and complete the operation. Note that this method is typically only accepted by servers that support version 1.1 of the protocol or later.

When using Write to send the contents of the file to the server, it is recommended that the data be written in logical blocks that are no larger than 8,192 bytes in size. Attempting to write very large amounts of data in a single call can either cause the thread to block or, in the case of an asynchronous connection, return an error if the internal buffers cannot accommodate all of the data. To send the entire contents of a file at once, use the PutData method instead of calling CreateFile.

See Also

CloseFile Method, OpenFile Method, PutData Method, PutFile Method, Write Method