Dart Ftp Control
Store Method
Specifies the remote filename (with path) to store, store unique or append to.
Optional String specifying a local filename, or a String, Byte array, or DartStream object that contains data to be sent. If a specified file cannot be found, then the String or Byte array is assumed to be data and is sent. If Data is not specified or NULL, RemoteFileName (without path) will be used to specify the file in the local default directory. If Type is ftpZip the file or files  will be compressed and stored on the remote directory with the name specified in the URL parameter plus the .zip extension. When using ftpZip, Data is not optional.
Optional. Specifies the number of bytes that should be skipped. If a file transfer was interrupted, the Marker parameter can be used to append to the existing file so the entire file does not have to be transferred. If Data is a local file name then the first (Marker) bytes are skipped. If Data contains data it is all sent (no bytes are skipped).
Optional. Use in conjunction with Marker to specify the number of bytes to be skipped in a large file. If a file transfer was previously interrupted, Marker and MarkerHigh can be used to start at an exact location greater than 2^31.
Description
Store (send) a complete file, or part of a file starting at a specified position.
Syntax
Visual Basic
Public Sub Store( _
   ByVal RemoteFileName As String, _
   Optional ByVal Data As Variant, _
   Optional ByVal Marker As Long = 0, _
   Optional ByVal MarkerHigh As Long = 0 _
) 
Parameters
RemoteFileName
Specifies the remote filename (with path) to store, store unique or append to.
Data
Optional String specifying a local filename, or a String, Byte array, or DartStream object that contains data to be sent. If a specified file cannot be found, then the String or Byte array is assumed to be data and is sent. If Data is not specified or NULL, RemoteFileName (without path) will be used to specify the file in the local default directory. If Type is ftpZip the file or files  will be compressed and stored on the remote directory with the name specified in the URL parameter plus the .zip extension. When using ftpZip, Data is not optional.
Marker
Optional. Specifies the number of bytes that should be skipped. If a file transfer was interrupted, the Marker parameter can be used to append to the existing file so the entire file does not have to be transferred. If Data is a local file name then the first (Marker) bytes are skipped. If Data contains data it is all sent (no bytes are skipped).
MarkerHigh
Optional. Use in conjunction with Marker to specify the number of bytes to be skipped in a large file. If a file transfer was previously interrupted, Marker and MarkerHigh can be used to start at an exact location greater than 2^31.
Remarks

Sequences and sends (if needed) the following commands (refer to the CommandConstants topic for more information on these commands):

Depending on the value of Marker and the StoreType property, ftpStoreUnique or ftpAppend may be sent instead of ftpStore.

If Marker is used, the ftpAppend command is used to send the data, so Marker must accurately reflects the size of the file on the server (since the data will be appended).

The Progress and Progress64 events fire as each file segment is sent or reply is received. If Timeout is greater than 0, Store blocks until the file is sent to the server or a ptTimeout error occurs. If Timeout is 0, Store immediately returns. In this case, if the Result parameter is used to capture the data, it must not go out of scope while the command completes (it must have file or global scope).

The Store method fires a ptFile error if the local file exists but could not be opened.

If Type is ftpZip the file or files specified in Data will be automatically compressed and transferred to the remote directory and file name identified in the URL. The URL must contain the name of the remote file. The file placed on the remote server will have an extension of .zip. The Data parameter is not optional if the ftpZip type is used. For more advanced zip functionality, please look at PowerTCP Zip Compression for ActiveX at www.dart.com.

MarkerHigh should be set to the value of the restart position divided by 2^31 (2147483648). Marker should be set to the remainder of this operation.

A ptInvalidParam2 error will occur if the size of Data is larger than 2^31 and is NOT a file.

If you wish to use a DartStream object as Result, you must first add a reference to DartSock.dll.

Error Codes

This method may generate the following error code (refer to ErrorConstants for a complete list of error codes):

Example
This example demonstrates storing a binary file.
Private Sub Command1_Click()
	On Error Goto OnError ' use intrinsic error handling
	Ftp1.Timeout = 1000
	' Store a binary file on the server
	Ftp1.Type = ftpImage
	Ftp1.Store "TheFile.exe"
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub
This example demonstrates automatically compressing a file, then storing.
Private Sub Command1_Click()
	On Error Goto onError

	' Login to the server
	Ftp1.Login "MyFtpServer", "MyUsername", "MyPass"

	' Specify the file type as ftpZip, this will cause it to be compressed, 
	' then stored
	Ftp1.Type = ftpZip

	' Store the file, since Type is ftpZip, it will be zipped first
	Ftp1.Store "ftpzip.zip", "c:\temp\test.htm"

	' Logout
	Ftp1.Logout

	Exit Sub
onError:
	Debug.Print Err.Description
End Sub
See Also

Ftp Object  | Ftp Members


PowerTCP FTP for ActiveX Documentation Version 2.2
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic