Guest User

Untitled

a guest
Jun 19th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // login info
  2. $ftp_server = "ftp.headbite.com";
  3. $ftp_user = "headbite@headbite.com";
  4. $ftp_pass = "xxxxxxxxx";
  5. // set up a connection or die
  6. $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
  7. // try to login
  8. if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
  9. echo "Connected as $ftp_user@$ftp_server\n";
  10. } else {
  11. echo "Couldn't connect as $ftp_user\n";
  12. }
  13. //passive mode on
  14. ftp_pasv ( $conn_id, true );
  15. // upload a file
  16. $file = $_SESSION['base_path'] . "plugins\\fvLinks\\" . $_SESSION['userId'] . '_links.txt';
  17. $remote_file = "/headbite.com/subdomains/www/html/links/" . $_SESSION['userId'] . '_links.txt';
  18. if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
  19. echo "successfully uploaded $file\n";
  20. } else {
  21. echo "There was a problem while uploading $file\n";
  22. }
  23. // close the connection
  24. ftp_close($conn_id);
Add Comment
Please, Sign In to add comment