Returns the size (in bytes) of a file located on the internet.
InetGetSize ( "URL" [, options = 0] )
URL | URL of the file to download. See remarks below. |
options | [optional] $INET_LOCALCACHE (0) = Get the file from local cache if available (default). $INET_FORCERELOAD (1) = Forces a reload from the remote site. $INET_IGNORESSL (2) = Ignore all SSL errors (with HTTPS connections). $INET_ASCIITRANSFER (4) = Use ASCII when transferring files with the FTP protocol (Can not be combined with flag $INET_BINARYTRANSFER (8)). $INET_BINARYTRANSFER (8) = Use BINARY when transferring files with the FTP protocol (Can not be combined with flag $INET_ASCIITRANSFER (4)). This is the default transfer mode if none are provided. Constants are defined in InetConstants.au3. |
Success: | the size of the file in bytes. |
Failure: | 0 and sets the @error flag to non-zero. |
The URL parameter should be in the form "http://www.somesite.com/path/file.html" - just like an address you would type into your web browser.
To use a username and password when connecting simply prefix the servername with "username:password@", e.g.
"http://myuser:mypassword@www.somesite.com"
Not all servers will correctly give the file size, especially when using a proxy server.
FtpSetProxy, HttpSetProxy, HttpSetUserAgent, InetGet, InetRead
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Retrieve the size of the file. The option of 'get the file from the local cache' has been selected.
Local $iSize = InetGetSize("http://www.autoitscript.com/autoit3/files/beta/update.dat")
MsgBox($MB_SYSTEMMODAL, "", "The size of the file: " & $iSize)
EndFunc ;==>Example