<< Back


FVSDK_MoveUp

Synopsis

FVSDK_ERROR_CODE FVSDK_MoveUp(FVSDK_Session* pSession, LPCTSTR pszSourcePath, LPCTSTR pszDestPath);

Description

Uploads one or more files to the connected server then deletes the local file. If using wildcards, multiple files can be uploaded into a single directory (pszDestPath). Use this function when you want to upload a file or files, then delete, with a single function call. Use FVSDK_CreateFile() to upload a single file in blocks, fully under your control.

When pSession->bConnectionSaver is TRUE (the default), this function waits (blocks) until the file transfer is complete. When pSession->bConnectionSaver is FALSE, this function returns prior to the transfer starting, making this function asynchronous (non-blocking).

Parameters

pSession

A pointer to the FVSDK_Session that is to perform the operation.

pszSourcePath

The local path to a single file or the path to a directory with a wild carded name.

pszDestPath

The remote path to a single file or a path where wild carded files are to be uploaded. If specifying a directory name for the destination, be sure to end the string with a / character to signify a directory.

Return Value

FVSDK_OK if successful; error codes can be found in FVSDK_ErrorCodes.h.

NOTE: If the session structure is valid, this function always returns FVSDK_OK. This is done because transfers can be asynchronous if bConnectionSaver is set to FALSE. To be notified of transfer errors, use the appropriate callback function found in the FVSDK_Session structure.

Example

// turn off connection saver so the uploads are asynchronous (non-blocking)
pSession->bConnectionSaver = FALSE;

// apply the session changes
FVSDK_ApplySessionChange(pSession);

// NOTE: because we turned connection saver off (above) the following functions will exit
// prior to completing the transfer

// move the file to the server (notice that the remove filename can be different)
FVSDK_MoveUp(pSession, "D:\\Temp\\fvsetup.exe", "/pub/rhinosoft/ftpvoyager/ftpvoyager.exe");

// move the file to the server
FVSDK_MoveUp(pSession, "D:\\Temp\\ftpvgerman.exe", "/pub/rhinosoft/ftpvoyager/");

// move all text files in the local path to the server
FVSDK_MoveUp(pSession, "D:\\Temp\\*.txt", "/pub/rhinosoft/ftpvoyager/");