Latest web development tutorials

PHP ftp_size () function

PHP FTP Reference Complete PHP FTP Reference

Definition and Usage

ftp_size () function returns the size of the file on the FTP server.

This function returns the bytes of the specified file size, or -1 if an error occurs.

grammar

ftp_size(ftp_connection,file)

参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
file 必需。规定要检查的文件。


Tips and Notes

Note: Not all FTP servers support this function.


Examples

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");

echo ftp_size($conn,"test.txt");

ftp_close($conn);
?>

The code above will output:

160


PHP FTP Reference Complete PHP FTP Reference