I'm attempting to test the "resume" functionality of FTPS via the .NET assembly by doing the following:
Starting an upload, and then midway through, killing the WinSCP process and disposing of the Session. This leaves a file with the correct name, but obviously the wrong size. At this point, I assume that starting a new
put will resume the transfer, but the file starts over from zero. I'm using the following code:
Add-Type -Path "WinSCPnet.dll"
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Ftp
$sessionOptions.HostName = $HostIP
$sessionOptions.UserName = $UserName
$sessionOptions.PortNumber = $HostPort
$sessionOptions.FtpSecure = "ExplicitSsl"
$sessionOptions.TlsHostCertificateFingerprint = $TlsKey
$sessionOptions.SecurePassword = $SecurePassword
$session = New-Object WinSCP.Session
$session.DebugLogPath = ".\ftpdebug.txt"
$session.SessionLogPath = ".\ftpsession.txt"
$session.Open($sessionOptions)
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::On
$transferResult = $session.PutFiles($TestUploadFile, "/", $False, $transferOptions)
Am I making a poor assumption? Missing something in my code? Both?
Thanks in advance for any assistance,
Darren