OpenFile Method  
 

Open a file on the server for reading.

Syntax

object.OpenFile( FileName )

Parameters

FileName
A string which specifies the name of the file being opened on the server. The client must have the appropriate access rights to open the file for reading or an error will be returned. It may be required that the UserName and Password properties be set to authenticate the client session so that access to the resource is permitted.

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 OpenFile method uses the GET command to access the file. If this method is successful, the client should then use the Read method to read the contents of the file from the server. Once all of the data has been read, the CloseFile method should be called to close the file and complete the operation. If the file being opened is not an HTML or text document, then it's recommended that you read the data into a byte array.

This method should not be used to post data to a script or other executable resource on the server. If you wish to post data to a script, then the PostData method should be used instead.

See Also

CloseFile Method, CreateFile Method, GetData Method, GetFile Method, PostData Method, Read Method