Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. // create directory through FTP connection
  3. function FtpMkdir($path, $newDir) {
  4.  
  5. $server='ftp.yourserver.com'; // ftp server
  6. $connection = ftp_connect($server); // connection
  7.  
  8.  
  9. // login to ftp server
  10. $user = "me";
  11. $pass = "password";
  12. $result = ftp_login($connection, $user, $pass);
  13.  
  14. // check if connection was made
  15. if ((!$connection) || (!$result)) {
  16. return false;
  17. exit();
  18. } else {
  19. ftp_chdir($connection, $path); // go to destination dir
  20. if(ftp_mkdir($connection,$newDir)) { // create directory
  21. return $newDir;
  22. } else {
  23. return false;
  24. }
  25. ftp_close($conn_id); // close connection
  26. }
  27.  
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement