Archived Forum Post

Index of archived forum posts

Question:

Chilkat HTTP Object (Activex) not get correct file size..

Nov 11 '13 at 10:45

Greetings...

i am facing a problem..

i need to get file size by using chilkat HTTP object. but it returns false value ..

this is an example url:

https://fbcdn-video-a.akamaihd.net/hvideo-ak-ash2/v/1242398_10202245220513615_760711674_n.mp4?oh=e991d6f3b61802c62b1139cbeea424f0&oe=527C8587&__gda__=1383890791_8af355f54d6a3339084e1679c168fa30

Internet download manager shows file size is 6.27MB..

but chilkat HTTP object return 176/174 bytes (sometimes 174 and sometimes 176) bytes only :(

why?

P.S i use following code to get file size:

http://example-code.com/vb/http_getDownloadSize.asp

any help would be highly appreciated :)

thanks in advance..

best regards


Answer

so, no helps?


Answer

Hi,

I just tried it and I am getting the correct file size. This code:

Sub TestHttp()
  Dim lo_Http As ChilkatHttp
  Dim lo_HttpResp As ChilkatHttpResponse

  Set lo_Http = New ChilkatHttp
  lo_Http.UnlockComponent "UnlockCode"

  Set lo_HttpResp = lo_Http.GetHead("https://fbcdn-video-a.akamaihd.net/hvideo-ak-ash2/v/1278194_10202241353856951_342991444_n.mp4?oh=a66ad318d4dc65fe491246e0bdc41485&oe=52807675&__gda__=1384150229_da98ed2789396651a6dc644c41e97310")
  Debug.Print "File size in bytes: " & Format$(lo_HttpResp.GetHeaderField("Content-Length"), "#,##0")
End Sub

Produces the following result for me:

File size in bytes: 6,560,454

Answer

Hi mAlam,

There are 2 important things that have not been answered:

  1. Are you using ChilkatHTTP 9.4.1? If not you should update and try your code again, the problem may have already been fixed.
  2. Can you post the results of the Header property of the ChilkatHTTPResponse object immediately after your call the GetHead method of the ChilatHTTP object?

Thanks.