![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Example: Http.ResumeDownload methodDemonstrates the
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Handle hoHttp String sLocalFilePath Integer iStatusCode Handle hoFac String sTemp1 Integer iTemp1 Move False To iSuccess Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Set ComKeepResponseBody Of hoHttp To True // To demonstrate resuming a download, we've created a file on the chilkatsoft.com // web server that contains the first 82,379 bytes of the full 279,658 bytes of the hamlet.xml file. // We'll first download the partial file, and pretend it was a previous incomplete attempt to download the entire file. Move "c:/temp/qa_output/hamlet.xml" To sLocalFilePath Get ComDownload Of hoHttp "https://www.chilkatsoft.com/testData/hamlet_partial.xml" sLocalFilePath To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End // Download the remainder of hamlet.xml. Get ComResumeDownload Of hoHttp "https://www.chilkatsoft.com/testData/hamlet.xml" sLocalFilePath To iSuccess Get ComLastStatus Of hoHttp To iStatusCode If (iSuccess = False) Begin If (iStatusCode = 0) Begin // Unable to either send the request or get the response. Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 End Else Begin // We got a response, but the status code was not in the 200s Showln "Response status code: " iStatusCode // Examine the response body. Showln "Response body:" Get ComLastResponseBody Of hoHttp To sTemp1 Showln sTemp1 End Showln "Download failed." End Else Begin Showln "Download success, response status = " iStatusCode End // The hamlet.xml file should be 279,658 bytes Get Create (RefClass(cComCkFileAccess)) To hoFac If (Not(IsComObjectCreated(hoFac))) Begin Send CreateComObject of hoFac End Get ComFileSize Of hoFac sLocalFilePath To iTemp1 Showln "size of hamlet.xml: " iTemp1 Showln "Success." End_Procedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.