Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use ftp_size() function in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 188
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to use ftp_size() function in php ?
    The ftp_size() function is used for returning the size of a specified file on the FTP server.
    This function returns the file size in bytes on success, or -1 on error

    syntax of ftp_size() function

    ftp_size(ftp_connection,file);
    

    ftp_connection is a required parameter
    file is a required parameter

    you can see bellow example:

    <?php
    //here call username and password
    $username="test"
    $userpass=12345;
    // connect and login to FTP server
    
    $ftp_server = "ftp.live.com";
    $conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
    $login = ftp_login($conn, $username, $userpass);
    
    $file = "file.txt";
    
    // get size of $file
    $filesize = ftp_size($conn, $file);
    //check file size
    if ($filesize != -1)
      {
      echo "$file is $fsize bytes.";
      }
    else
      {
      echo "Error getting file size.";
      }
    
    //here close connection
    ftp_close($conn);
    ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: