note 108507 added to function.ftp-mkdir

From: Date: Wed, 02 May 2012 16:59:27 +0000
Subject: note 108507 added to function.ftp-mkdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-187443@lists.php.net to get a copy of this message
Create recursive ftp directory: (UPDATED!) function ftp_mkdir_recusive($con_id,$path){ $fullpath = ftp_pwd($con_id); foreach(explode("/",$path) as $part){ $fullpath .= $part."/"; if(empty($part)){ continue; } if(!@ftp_chdir($con_id, $fullpath)){ if(@ftp_mkdir($con_id, $part)){ ftp_chdir($con_id, $part); }else{ return false; } } } return true; } $dir = "/2012/05/02/" if(ftp_mkdir_recusive($con_id,$dir)){ print("Successfully created $dir"); }else{ print("There was a problem while creating $dir"); } ---- Server IP: 208.69.120.55 Probable Submitter: 216.201.6.105 ---- Manual Page -- http://www.php.net/manual/en/function.ftp-mkdir.php Edit -- https://master.php.net/note/edit/108507 Del: integrated -- https://master.php.net/note/delete/108507/integrated Del: useless -- https://master.php.net/note/delete/108507/useless Del: bad code -- https://master.php.net/note/delete/108507/bad+code Del: spam -- https://master.php.net/note/delete/108507/spam Del: non-english -- https://master.php.net/note/delete/108507/non-english Del: in docs -- https://master.php.net/note/delete/108507/in+docs Del: other reasons-- https://master.php.net/note/delete/108507 Reject -- https://master.php.net/note/reject/108507 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187443) next »