PHP ftp_size()Functions
Complete PHP FTP Reference Manual
Definition and Usage
The ftp_size() function returns the size of the specified file on the FTP server.
This function returns the size of the specified file in bytes, or -1 if an error occurs.
Syntax
ftp_size(ftp_connection,file)
| Parameters | Description |
|---|---|
| ftp_connection | Required. Specifies the FTP connection to use. |
| file | Required. Specifies the file to check. |
Tips and Notes
Note:Not all FTP servers support this function.
Example
<?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);
?>
$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
Complete PHP FTP Reference Manual Other Extensions