oFTP.InternetWriteFile()

FTPv2.ahk / oFTP

oFTP.InternetWriteFile()


Uploads a file (with progress bar)

oFTP.InternetWriteFile(LocalFile, [NewRemoteFile, FnProgress])

Parameters

LocalFile

Path of local file to upload

NewRemoteFile

(Optional) Remote file name/path (if omitted, defaults to name of Local file)

FnProgress

(Optional) Name of function to handle progress (similar to registercallback). If not specified, built in function to show progress is used. (see example)

Return Value

True on success, false otherwise.

Remarks

Use .LastError property to get error data

Related

oFTP.InternetReadFile()

Example

oFTP.InternetWriteFile("TestFile.zip", "RTestFile.zip", "MyProgressFunction")
MyProgressFunction() {
global oFTP
static init
my := oFTP.File
ntotal := my.BytesTotal
if ( my.TransferComplete )
{
Progress, Off
return 1 , init := 0
}
str_sub := "Time Elapsed - " . Round((my.CurrentTime - my.StartTime)/1000) . " seconds"
if !init
{
str_main := my.LocalName . A_Tab . (my.TransferDownload ? "<-":"->") . A_Tab . my.RemoteName
Progress,M R0-%ntotal% P0,%str_sub%, %str_main% ,FTP Transfer Progress
return 1, init :=1
}
Progress, % my.BytesTransfered
Progress,,%str_sub%
}