PHP uses FTP functions to create a directory (generate static)

Source: Internet
Author: User
  1. /**

  2. * Desc:create directory through FTP connection
  3. * link:bbs.it-home.org
  4. * DATE:2013/02/24
  5. */
  6. function Ftpmkdir ($path, $newDir) {
  7. $server = ' ftp.yourserver.com '; FTP Server
  8. $connection = Ftp_connect ($server); Connection
  9. Login to FTP server
  10. $user = "Me";
  11. $pass = "password";
  12. $result = Ftp_login ($connection, $user, $pass);
  13. Check if connection was made
  14. if ((! $connection) | | (! $result)) {
  15. return false;
  16. Exit ();
  17. } else {
  18. Ftp_chdir ($connection, $path); Go to Destination dir
  19. if (Ftp_mkdir ($connection, $newDir)) {//Create directory
  20. return $newDir;
  21. } else {
  22. return false;
  23. }
  24. Ftp_close ($conn _id); Close connection
  25. }
  26. }
  27. ?>

Copy Code
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.