FsPutFile
FsPutFile is called to transfer a file from the normal file system (drive letters or UNC) to the plugin's file system.
Declaration:
int __stdcall FsPutFile(char* LocalName,char* RemoteName,int CopyFlags);
Description of parameters:
LocalName Local file name with full path, either with a drive letter or UNC path (\\Server\Share\filename). This file needs to be uploaded to the plugin's file system.
RemoteName Name of the remote file, with full path. The name always starts with a backslash, then the names returned by FsFindFirst/FsFindNext separated by backslashes. The plugin may change the NAME/EXTENSION of the file (e.g. when file conversion is done), but not the path!
CopyFlags Can be a combination of the FS_COPYFLAGS_xxx flags
FS_COPYFLAGS_OVERWRITE: If set, overwrite any existing file without asking. If not set, simply fail copying.
FS_COPYFLAGS_RESUME: Resume an aborted or failed transfer.
FS_COPYFLAGS_MOVE: The plugin needs to delete the local file after uploading
FS_COPYFLAGS_EXISTS_SAMECASE: A hint from the calling program: The remote file exists and has the same case (upper/lowercase) as the local file.
FS_COPYFLAGS_EXISTS_DIFFERENTCASE: A hint from the calling program: The remote file exists and has different case (upper/lowercase) than the local file.
See below for important notes!
Return value:
Return one of the following values:
FS_FILE_OK The file was copied OK
FS_FILE_EXISTS The remote file already exists, and resume isn't supported
FS_FILE_NOTFOUND The local file couldn't be found or opened.
FS_FILE_READERROR There was an error reading from the local file
FS_FILE_WRITEERROR There was an error writing to the remote file, e.g. disk full
FS_FILE_USERABORT Copying was aborted by the user (through ProgressProc)
FS_FILE_NOTSUPPORTED The operation is not supported (e.g. resume)
FS_FILE_EXISTSRESUMEALLOWED The remote file already exists, and resume is supported
Important notes
Total Commander usually calls this function twice, with the following parameters in CopyFlags:
- once with neither FS_COPYFLAGS_RESUME nor FS_COPYFLAGS_OVERWRITE set. If the remote file exists and resume is supported, return FS_FILE_EXISTSRESUMEALLOWED. If resume isn't allowed, return FS_FILE_EXISTS
- a second time with FS_COPYFLAGS_RESUME or FS_COPYFLAGS_OVERWRITE, depending on the user's choice. The resume option is only offered to the user if FS_FILE_EXISTSRESUMEALLOWED was returned by the first call.
- The flags FS_COPYFLAGS_EXISTS_SAMECASE or FS_COPYFLAGS_EXISTS_DIFFERENTCASE are added to CopyFlags when the remote file exists and needs to be overwritten. This is a hint to the plugin to allow optimizations: Depending on the plugin type, it may be very slow to check the server for every single file when uploading.
- If the flag FS_COPYFLAGS_MOVE is set, the plugin needs to delete the local file after a successful upload.
While copying the file, but at least at the beginning and the end, call ProgressProc to show the copy progress and allow the user to abort the operation.