note 108505 added to function.ftp-mkdir

From: Date: Wed, 02 May 2012 15:04:59 +0000
Subject: note 108505 added to function.ftp-mkdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-187441@lists.php.net to get a copy of this message
Create recursive ftp directory: function ftp_mkdir_recusive($con_id,$path){ $parts = explode("/",$path); $return = true; $fullpath = ""; foreach($parts as $part){ if(empty($part)){ $fullpath .= "/"; continue; } $fullpath .= $part."/"; if(@ftp_chdir($con_id, $fullpath)){ ftp_chdir($con_id, $fullpath); }else{ if(@ftp_mkdir($con_id, $part)){ ftp_chdir($con_id, $part); }else{ $return = false; } } } return $return; } $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/108505 Del: integrated -- https://master.php.net/note/delete/108505/integrated Del: useless -- https://master.php.net/note/delete/108505/useless Del: bad code -- https://master.php.net/note/delete/108505/bad+code Del: spam -- https://master.php.net/note/delete/108505/spam Del: non-english -- https://master.php.net/note/delete/108505/non-english Del: in docs -- https://master.php.net/note/delete/108505/in+docs Del: other reasons-- https://master.php.net/note/delete/108505 Reject -- https://master.php.net/note/reject/108505 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187441) next »