get size with InternetOpenUrl

How can I get the size of the document I request with InternetOpenUrl ? InternetSetFilePointer SEEK_END does not work .
Thanks
LVL 6
WxWAsked:
Who is Participating?
 
satishks060799Connect With a Mentor Commented:
One way i am using is

long FileSize ;
DWORD Len = sizeof ( FileSize );

Handle = HTTPOpenRequest ( .. );
HTTPSendRequest ( Handle, .. );
HTTPQueryInfo ( Handle, HTTP_QUERY_CONTENT_LENGTH, FileSize, &Len, NULL ) ;

This will work 100%.
0
 
mikeblasCommented:
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
0
 
WxWAuthor Commented:
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.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mikeblasCommented:
Like I said, there isn't.

Good luck with your project.

..B ekiM
0
 
chensuCommented:
>This will work 100%.

Try http://www.experts-exchange.com.
0
 
WxWAuthor Commented:
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 .
0
 
chensuCommented:
>I do believe its a SDK bug and not an EE server bug.

Bug? You are such a good joker.
0
All Courses

From novice to tech pro — start learning today.