The ftp_mkdir() function is used to create a new directory on the FTP server.
Syntax
ftp_mkdir(con,dir);
Parameters
con − The FTP connection
dir − The name of the directory to be created
Return
The ftp_mkdir() function returns name of the directory on success, or FALSE on failure
Example
The following is an example that creates a new directory −
<?php $ftp_server="192.168.0.4"; $ftp_user="amit"; $ftp_pass="tywg61gh"; $con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); $login = ftp_login($con, $ftp_user, $ftp_pass); $newdir = "new.txt"; if (ftp_mkdir($con, $newdir)){ echo "Created the new directory successfully!"; } else { echo "The new directory cannot be created!"; } ftp_close($con); ?>