Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. $ftp = "ftp";
  2. $username = "username";
  3. $pwd = "password";
  4. $filename = $_FILES[$xyz][$abc];
  5. $tmp = $_FILES['file']['tmp_name'];
  6. $destination = "/Content/EnquiryXML ";
  7.  
  8. $connect = ftp_connect($ftp)or die("Unable to connect to host");
  9. ftp_login($connect,$username,$pwd)or die("Authorization Failed");
  10. echo "Connected!<br/>";
  11.  
  12. if(!$filename)
  13. {
  14. echo"Please select a file";
  15. }
  16.  
  17. else
  18. {
  19. ftp_put($connect,$destination.'/'.$filename,$tmp,FTP_ASCII)or die("Unable to upload");
  20. echo"File successfully uploaded to FTP";
  21. }
  22.  
  23. $connect = ftp_connect($ftp) or die("Unable to connect to host");
  24. ftp_login($connect, $username, $pwd) or die("Authorization Failed");
  25. // turn passive mode on
  26. ftp_pasv($connect, true);
  27.  
  28. $ftp_server = "host";
  29. $ftp_username = "username";
  30. $ftp_userpass = "password";
  31.  
  32. $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
  33. $login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
  34.  
  35. $file ="$abc";
  36.  
  37. // upload file
  38. if (ftp_put($ftp_conn, "/$abc" , $file, FTP_ASCII))
  39. {
  40. echo "Successfully uploaded $file.";
  41. }
  42. else
  43. {
  44. echo "Error uploading $file";
  45. }
  46.  
  47. // close connection
  48. ftp_close($ftp_conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement