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 ?
- D3.js | d3.hsl() Function
- D3.js | d3.sum() function
- PHP | exp() Function
- PHP | Ds\Map xor() Function
- PHP | cos( ) Function
- PHP | sin( ) Function
- PHP | tan( ) Function
- PHP | Ds\Map put() Function
- D3.js | d3.max() function
- PHP | pi( ) Function
- D3.js | d3.set.has() Function
- PHP | next() 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 email@example.com. 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.