Link to home
Start Free TrialLog in
Avatar of WxW
WxW

asked on

get size with InternetOpenUrl

How can I get the size of the document I request with InternetOpenUrl ? InternetSetFilePointer SEEK_END does not work .
Thanks
Avatar of mikeblas
mikeblas

Size information is genrally not available using this API. Seeking will only work if the file is already cached, and that's your only hope with this API.

You need to write your own code to use the lower-level APIs. If the file you're reading is a FTP file, you can get the file size by doing an FtpFileFind().

If the file is an HTTP resource, you _may_ be able to get the file size by querying for the "Content-Length" header.

..B ekiM
Avatar of WxW

ASKER

I already know the lower level http and ftp communication . The problem is that I don't want to embedd some kbs ( and change programming style ) to only know the size of the contents .

I saw that when opening FTP , the InternetOpenUrl gets the size using the SIZE FTP command . There must be a way.
Like I said, there isn't.

Good luck with your project.

..B ekiM
ASKER CERTIFIED SOLUTION
Avatar of satishks060799
satishks060799

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>This will work 100%.

Try https://www.experts-exchange.com.
Avatar of WxW

ASKER

I used InternetOpenUrl with HttpQuery and it works . I know there are sites that do not return the content-length ( and what I mostly hate in the net is the failure of size information and restarting to a specific position ) . I checked the thing with EE and it won't work as chensu said . However , I do believe its a SDK bug and not an EE server bug .
>I do believe its a SDK bug and not an EE server bug.

Bug? You are such a good joker.