PHP ftp_mkdir() Function

Definition and Usage

The ftp_mkdir() function creates a new directory on the FTP server.

Syntax

ftp_mkdir(ftp_connection,dir)
Parameter Description
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
dir Required. Specifies the name of the directory to be created.

Description

Create a directory with the name of the parameter on the FTP server dir Create a new directory.

If successful, it returns the name of the newly created directory, otherwise it returns false.

Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_mkdir($conn,"testdir");
ftp_close($conn);
?>

Output:

/testdir