flat assembler
Message board for the users of flat assembler.

Index > Windows > http how to get file size

Author
Thread Post new topic Reply to topic
HarryTuttle



Joined: 26 Sep 2003
Posts: 211
Location: Poland
HarryTuttle
I usually got a file from www by calling '3 API functions

1: InternetOpen
2: InternetOpenUrl
3: InternetReadFile or ReadFIle(but this one has one parametr more than InternetReadFile)


How to get the size of a remote file.

In oposite to Ftp which has FtpGetFileSize I have no idea what to do with www servers.

How do you know how many bytes the file is long?



P.S. the bigger parametr as a 3th in InternetReadFile gets a bad result.

heyah!

_________________
Microsoft: brings power of yesterday to computers of today.
Post 18 Oct 2004, 13:03
View user's profile Send private message Reply with quote
inskipp



Joined: 23 Jun 2003
Posts: 25
Location: Poland
inskipp
You can try the old trick from DOS:
Code:
invoke InternetSetFilePointer,hFile,0,0,FILE_END,0
    

and the return value will be file size
(or -1). Don't forget to set pointer back to FILE_BEGIN if you want to dowload file.
I think you can also use the HttpQueryInfo function, but this will be harder.
Post 18 Oct 2004, 16:43
View user's profile Send private message ICQ Number Reply with quote
gorshing



Joined: 27 Jul 2003
Posts: 72
Location: Okla, US
gorshing
Or you could read the RFC and pull the size out of the HTTP Response.

Which I believe is .... http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13

_________________
gorshing
Post 18 Oct 2004, 21:14
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.