Upload files to remote server

To upload files on remote server php built-in function ftp_put() is used.
Just follow these simple steps.

1. Make ftp connection with remote server.
2. Login with remote server username and Password.
3. Use ftp_put() function

The syntax of ftp_put() function :


Here is the example code :

  //Change this
  $server = 'anysite.com';
  $username = 'username';
  $password = 'password';
  $local_file = 'original.jpg';
  $remote_file = 'uploaded.jpg';

  $conn = ftp_connect($server);
  $login = ftp_login($conn, $username, $password);

  ftp_put($conn, $remote_file, $local_file, FTP_ASCII);

Upload files to remote server Upload files to remote server Reviewed by Altaf Hussain on 4:45 PM Rating: 5

No comments:

Altaf Web. Powered by Blogger.