use the ftp_* functions to upload a single file to an FTP server. : FTP Functions « Network « PHP






use the ftp_* functions to upload a single file to an FTP server.

 
<?php
$conn = ftp_connect ( "ftp.somedomain.com" );
if ($conn) {
  $session = ftp_login ( $conn, "user", "pass" );
  if ($session) {
    if (ftp_chdir ( $conn, "somedir" )) {
      ftp_put ( $conn, "remote.txt", "local.txt", FTP_ASCII );
    }
  }
  ftp_close ( $conn );
}
?>
  
  








Related examples in the same category

1.FTP Functions
2.Write to file with ftp functions
3.Write to remote file on a ftp server
4.Saving a remote file via FTP with file_put_contents()
5.Using a password with FTP or HTTP
6.ftp put