can someone tell me how I can check filesize before downloading from page www. example I have file .rar in www.mypage.pl/users/programs/program.rar And I can download only with ftp but I want first check how is size this file from C# in windowsForm and later download. This will my check update for program, if the size of the file on a website differences of size on the disk, it gets. But I don`t know how I can check this size and later how download normly
Asked
Active
Viewed 1,194 times
-1
-
Add the c# tag. But also, what research effort or attempt at trying this have you made? – D. Ben Knoble Jan 11 '16 at 11:17
-
See this answer: http://stackoverflow.com/questions/122853/get-http-file-size/122984#122984 – AleFranz Jan 11 '16 at 11:37
1 Answers
2
If you issue an http HEAD request to the resource in question the Content-Length header will give you the size in bytes. HEAD allows you to retrieve just the headers (rather than full content body) and Content-Length tells you the size of the payload that would have been downloaded had this been an http GET. Please see Content-Length header with HEAD requests?.
-
_"the Content-Length header [**should**] give you the size in bytes"_ - it doesn't _have_ to be implemented, especially for content that is generated on request. – CodeCaster Jan 11 '16 at 11:40