Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Tcl Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(Tcl) Restart/Resume FTP Upload

Demonstrates how to restart / resume an FTP upload.

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

set ftp [new_CkFtp2]

#  Any string unlocks the component for the 1st 30-days.
set success [CkFtp2_UnlockComponent $ftp "Anything for 30-day trial"]
if {[expr $success != 1]} then {
    puts [CkFtp2_lastErrorText $ftp]
    delete_CkFtp2 $ftp
    exit
}

CkFtp2_put_Hostname $ftp "ftp.chilkatsoft.com"
CkFtp2_put_Username $ftp "****"
CkFtp2_put_Password $ftp "****"

#  Connect and login to the FTP server.
set success [CkFtp2_Connect $ftp]
if {[expr $success != 1]} then {
    puts [CkFtp2_lastErrorText $ftp]
    delete_CkFtp2 $ftp
    exit
}

#  Change to the remote directory where the file will be uploaded.
set success [CkFtp2_ChangeRemoteDir $ftp "temp"]
if {[expr $success != 1]} then {
    puts [CkFtp2_lastErrorText $ftp]
    delete_CkFtp2 $ftp
    exit
}

#  In this example, assume that a previous FTP upload failed,
#  and the incomplete file (bigFile.zip) exists on the FTP server.
#  You only need to set the RestartNext property to resume
#  the upload.  When RestartNext is set, the next call
#  to PutFile (or PutFileFromBinaryData, PutFileFromTextData)
#  will automatically resume the upload from the point of failure.
#  (The way it works is that the FTP component sends a "SIZE";
#  command to the FTP server to find out how many bytes of
#  the file already exist on the server.  It then begins
#  uploading from that point.

#  Note: After PutFile is called, the RestartNext property
#  is automatically set to false.
CkFtp2_put_RestartNext $ftp 1

#  Upload a file with restart.
set localFilename "bigFile.zip"
set remoteFilename "bigFile.zip"

set success [CkFtp2_PutFile $ftp $localFilename $remoteFilename]
if {[expr $success != 1]} then {
    puts [CkFtp2_lastErrorText $ftp]
    delete_CkFtp2 $ftp
    exit
}

set success [CkFtp2_Disconnect $ftp]

puts "File Uploaded!"

delete_CkFtp2 $ftp

 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.