InetGetSize
返回互联网上文件的字节大小.
InetGetSize ( "URL" [, options = 0] )
参数
URL
|
要下载文件的 URL(地址). 见备注.
|
options
|
[可选]
$INET_LOCALCACHE (0) = 如有可能,则从本地缓存中获取文件 (默认值).
$INET_FORCERELOAD (1) = 强制从远程站点重新加载.
$INET_IGNORESSL (2) = 忽略所有 SSL 错误(使用 HTTPS 连接时).
$INET_ASCIITRANSFER (4) = 使用 FTP 协议传输 ASCII 文件(不能和标志 $INET_BINARYTRANSFER (8) 一起使用).
$INET_BINARYTRANSFER (8) = 使用 FTP 协议传输二进制文件(不能和标志 $INET_ASCIITRANSFER (4) 一起使用). 这是默认传输方式.
常量定义在 InetConstants.au3
|
返回值
成功:
|
返回文件的字节大小.
|
失败:
|
返回 0, @error 设置 为非 0 值.
|
备注
必须 Internet Explorer 3 或更高版本. (对于 ftp:// URLs 必须 IE 5!)
URL 参数的形式 "http://www.somesite.com/path/file.html" - 如同在网页浏览器中输入的地址.
指定用户名及密码,只要在服务器前加 "用户名:密码@", 例如:
"http://myuser:mypassword@www.somesite.com"
并非所有服务器都能返回正确的文件大小, 尤其在使用代理的情况下.
函数示例
#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
----------------------------------------
该函数可以通过命令调用 exect
参见:
InetGet, InetRead, HttpSetProxy, FtpSetProxy, HttpSetUserAgent
exect=$var_i=InetGetSize('http://tc-image.3dn.ru/Image/Sitelogo/TCImageGroup_18.png')||_ViewValues($var_i) ;; 获取文件大小字节
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|