PHP code example of nassiry / filesize-handler-ftp-extension

1. Go to this page and download the library: Download nassiry/filesize-handler-ftp-extension library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nassiry / filesize-handler-ftp-extension example snippets


use Nassiry\FileSizeUtility\FileSizeHandler;
use Nassiry\FileSizeUtility\Extensions\FtpFiles;

$handler = FileSizeHandler::create()
    ->from(new FtpFiles(
        'ftp.example.com',    // FTP host
        'ftp_user',           // FTP username
        'ftp_password',       // FTP password
        '/path/to/file.txt'   // File path on FTP server
    ))
    ->formattedSize();

echo $handler; // Output: "4.56 MiB"