Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IntGetFileSize
#2
Because file size was more than int range. This version supports any file size. Returns long, not int.

Function IntGetFileSize
Code:
Copy      Help
;/
function'long $url [inetflags]

;Returns internet file size.

;url - file URL.
;inetflags - optional dwFlags argument for InternetOpenUrl API.

;REMARKS
;Sends request to download the file, but gets only response headers, not whole file.
;Error if fails, or if file size is not specified in response headers (no Content-Length header).


#opt nowarnings 1
Http http
__HInternet hi=InternetOpenUrl(http.hinternet(1) url 0 0 inetflags 0); if(!hi) end "failed"
_s.all(30); _i=30
if(!HttpQueryInfo(hi HTTP_QUERY_CONTENT_LENGTH _s &_i 0)) end "unknown size"
ret val(_s.fix 1)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)