Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
HTTP Upload with Progress MonitoringNote: Version 2.2.3 released on 27-June-2007 is required for this example. The source code for this example is available here: VB6 HTTP Upload Demonstrates how to do an HTTP upload with progress monitoring. ' Dim WithEvents http As ChilkatHttp Private Sub Command4_Click() Set http = New ChilkatHttp http.UnlockComponent "Anything for 30-day trial" http.HeartbeatMs = 100 ' You may use this exact URL for testing. ' The full URL is a combination of the hostname passed to ' SynchronousRequest (below) and the req.Path. In this case, ' it is http://www.chilkatsoft.com/cgi-bin/ConsumeUpload.exe Dim req As New ChilkatHttpRequest req.UseUpload req.AddFileForUpload "file1", "hamlet.xml" req.Path = "/cgi-bin/ConsumeUpload.exe" ' Do the upload uploading = True Dim response As ChilkatHttpResponse Set response = http.SynchronousRequest("www.chilkatsoft.com", 80, 0, req) Text1.Text = http.LastErrorText End Sub ' The AbortCheck event is called periodically according to the ' HeartbeatMs property setting. Private Sub http_AbortCheck(abort As Long) If (ProgressBar2.Value > 95) Then ProgressBar2.Value = 0 Else ProgressBar2.Value = ProgressBar2.Value + 5 End If End Sub ' This event fires just before beginning to receive the HTTP response. Private Sub http_BeginReceive() List1.AddItem "Begin Receive" End Sub ' This event fires just before beginning to send the HTTP upload. Private Sub http_BeginSend() List1.AddItem "Begin Send" End Sub ' This event fires just after the HTTP response has been received in full. ' (or after a failure in reading the response). If reading the response ' failed, success is set to 0. Otherwise it is set to 1. Private Sub http_EndReceive(ByVal success As Long) List1.AddItem "End Receive" End Sub ' This event fires just after the HTTP upload has been sent. ' (or after a failure in sending the upload). If sending the upload ' failed, success is set to 0. Otherwise it is set to 1. Private Sub http_EndSend(ByVal success As Long) List1.AddItem "End Send" End Sub ' The pctDone argument will contain a value from 1 to 100. Private Sub http_PercentDone(ByVal pctDone As Long) ProgressBar1.Value = pctDone End Sub |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.