Send a file via FTP.

/ Published in: PHP
Save to your folder(s)

A simple example of how to send a file via FTP using PHP.

Copy this code and paste it in your HTML
  1. <?php
  2. $connection = ftp_connect($server);
  3. $login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
  4. if (!$connection || !$login) { die('Connection attempt failed!'); }
  5. $upload = ftp_put($connection, $dest, $source, $mode);
  6. if (!$upload) { echo 'FTP upload failed!'; }
  7. ftp_close($connection);
  8. ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.