[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Filesize using Wininet but not using ftp protocol

Posted on 2003-10-29
4
Medium Priority
?
250 Views
Last Modified: 2010-04-05
Hi.

Question same as in title. Need to find out what is the file size (in bytes) that is placed on web server. Is it possible when working with wininet ??

Thank you in advance
0
Comment
Question by:Murdoc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:Murdoc
ID: 9644890
..i forgot to tell you that i do not want to use wininet ftp protocol   :)
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9647502
I think that if you do a HEAD, you can check the content-length...
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 400 total points
ID: 9647539
better yet, you can do it like this with HttpQueryInfo:

var
  hSession: HINTERNET;
  hService: HINTERNET;
  FileSize: Longint;
  dwSize, Reserved: DWORD;
  buf: String;
begin
  hSession := InternetOpen( 'MyApp', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0 );
  if Assigned( hSession ) then
  begin
    hService := InternetOpenUrl(hSession, PChar(sURL), nil, 0, 0, 0);
    if Assigned( hService ) then
    begin
      dwSize := sizeof(FileSize);
      Reserved := 0;
      HttpQueryInfo(hService, HTTP_QUERY_CONTENT_LENGTH or HTTP_QUERY_FLAG_NUMBER,
                    @FileSize, dwSize, Reserved);
      buf := Format('FileSize:%d', [FileSize]);
      Memo1.Lines.Add( buf );
    end;
    InternetCloseHandle( hService );
  end;
  InternetCloseHandle( hSession );
end;
0
 

Author Comment

by:Murdoc
ID: 9648579
Thanks a lot Eddie.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question