Reply to comment

Good trick 'but but'

only two mistakes on the code... one ; missing and one ) repeated

function mkdir_ftp($directory) {
global $ftpuser,$ftppass,$ftpmkdir,$ftpdir;
$directory = $ftpdir . $directory;
$ftpConn = ftp_connect($_SERVER['use your server name here']);
if(false == ftp_login($ftpConn,$ftpuser , $ftppass)) {
watchdog('file system',
'The directory cannot be created, ftp_login() failed.',
array(), WATCHDOG_ERROR);
return FALSE;
}
$list=split("/",$directory);
$directory="";$first=true;
foreach($list as $ldir){
if ($first)
$directory.="".$ldir;
else
$directory.="/".$ldir;
$first=false;
ftp_mkdir($ftpConn, $directory);
ftp_chmod($ftpConn, 0777, $directory);
}
ftp_close($ftpConn);
return TRUE;
}

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br>
  • Lines and paragraphs break automatically.

More information about formatting options

Mollom CAPTCHA (play audio CAPTCHA)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.