How To Upload File Via FTP Using PHP Code?

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Shane
    Senior Member
    • Jun 2006
    • 264

    How To Upload File Via FTP Using PHP Code?

    Hello All,

    In order to upload file/s or folder/s on web server using PHP Code one can use below mentioned sample script:

    <?php
    require_once "PHPFTP.php";

    $ftp = new PHPFTP();

    $result = $ftp->Connect('www.yourdomain.com','login name','password');
    if ($result == 0)
    {
    $ftp->DoCommand('enter command here', $result_number, $result_text);
    echo "$result_text ($result_number)";
    $ftp->DoCommand('another command', $result_number, $result_text);
    echo "$result_text ($result_number)";
    $ftp->Disconnect();
    }
    ?>

    That's it!

    Thanks,

    Shane G.
    AccuWebHosting.Com
    Last edited by admin; 08-04-2015, 08:25 AM.
Working...
X