The ftp_size() function is an inbuilt function in PHP which is used to get the size of a given file on FTP server.
ftp_size( $ftp_connection, $file_name );
Parameter: This function accepts two parameters as mentioned above and described below:
- $ftp_connection: It is required parameter. It specifies the already existing FTP connection to use where the file exists.
- $file_name: It is required parameter. It specifies the file or file path on remote server i.e. FTP server.
Return Value: It returns the size of file on success or -1 on error.
- All ftp server doesn’t support this function.
- This function is available on PHP 4.0.0 and newer version.
- The following examples cannot be run on online IDE. So try to run in some PHP hosting server or localhost with proper ftp server name.
Below examples illustrate the ftp_size() function in PHP:
Example 2: Connect to ftp server using port number 21.
- How to get the function name inside a function in PHP ?
- CSS | rgb() Function
- PHP | Ds\Set last() Function
- PHP | Ds\Set first() Function
- PHP | Ds\Set add() Function
- PHP Ds\Set sum() Function
- PHP | Ds\Map xor() Function
- PHP | end() Function
- CSS | var() Function
- D3.js | d3.mean() function
- PHP | tan( ) Function
- CSS | hsl() Function
- p5.js | sq() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.