![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_size() function in PHP
The ftp_size() function is used to get the size of a particular file on the FTP server.
Syntax
ftp_size(conn, myfile)
Parameters
conn − The FTP connection
myfile − The server file
Return
The ftp_size() function returns the size of the particular file in bytes on success.
Example
The following is an example to get the size of file “new.txt” −
<?php $ftp_server = "192.168.0.4"; $ftp_user = "username"; $ftp_pass = "gfhgfj236k"; $conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); $login = ftp_login($con, $ftp_user, $ftp_pass); $myfile = "new.txt"; //size of $file $size = ftp_size($conn, $myfile); if ($size ! = -1) { echo "Size is $fsize bytes"; } else { echo "Cannot get the file size!"; } // close ftp_close($conn); ?>
Advertisements