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) Bandwidth Throttled Asynchronous HTTP Upload

Demonstrates how to do an HTTP upload asynchronously in a background thread with limiting the rate to an approximate number of bytes/second. The only difference between this example and one without bandwidth throttling is that the BandwidthThrottleUp property is set.

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

set upload [new_CkUpload]

#  Specify the page (ASP, ASP.NET, Perl, Python, Ruby, CGI, etc)
#  that will process the HTTP Upload.
CkUpload_put_Hostname $upload "www.mywebserver.com"
CkUpload_put_Path $upload "/receiveUpload.aspx"

#  Add one or more files to be uploaded.
CkUpload_AddFileReference $upload "file1" "dude.gif"
CkUpload_AddFileReference $upload "file2" "pigs.xml"
CkUpload_AddFileReference $upload "file3" "sample.doc"

#  Set the BandwidthThrottleUp property to throttle to approx 64K/second
CkUpload_put_BandwidthThrottleUp $upload 65536

#  Begin the HTTP upload in a background thread:
set success [CkUpload_BeginUpload $upload]
if {[expr $success != 1]} then {
    puts [CkUpload_lastErrorText $upload]
} else {
    puts "Upload started..."
}

#  Wait for the upload to finish.
#  Print the progress as we wait...
while {[expr [CkUpload_get_UploadInProgress $upload] == 1]} {
    #  We can abort the upload at any point by calling:
    #  upload.AbortUpload();

    #  Display the percentage complete and the number of bytes uploaded so far..
    #  The total upload size will become set after the upload begins:
    puts [CkUpload_get_PercentUploaded $upload]% [CkUpload_get_NumBytesSent $upload]/[CkUpload_get_TotalUploadSize $upload]

    #  Sleep 2/10ths of a second.
    [CkUpload_SleepMs $upload 200]

}

#  Did the upload succeed?
if {[expr [CkUpload_get_UploadSuccess $upload] == 1]} then {
    puts "Files uploaded!"
} else {
    puts [CkUpload_lastErrorText $upload]
}


delete_CkUpload $upload

 

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