note 40805 modified in function.ftp-mkdir by felipe

From: Date: Fri, 18 Apr 2008 16:31:43 +0000
Subject: note 40805 modified in function.ftp-mkdir by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138502@lists.php.net to get a copy of this message
For recurrent following function work better. Some ftp servers (like WarFTP) become demented if you'll try mkdir not from root dir and if path will be relative. The second if one of dir (like '/') already exist You'll get access denied. function MkDir($path) { $dir=split("/", $path); $path=""; $ret = true; for ($i=0;$i<count($dir);$i++) { $path.="/".$dir[$i]; echo "$path\n"; if(!@ftp_chdir($this->conn_id,$path)){ @ftp_chdir($this->conn_id,"/"); if(!@ftp_mkdir($this->conn_id,$path)){ $ret=false; break; } } } return $ret; } --was-- For recurrent following function work better. Some ftp servers (like WarFTP) become demented if you'll try mkdir not from root dir and if path will be relative. The second if one of dir (like '/') already exist You'll get access denied. function MkDir($path) { $dir=split("/", $path); $path=""; $ret = true; for ($i=1;$i<count($dir);$i++) { $path.="/".$dir[$i]; echo "$path\n"; if(!@ftp_chdir($this->conn_id,$path)){ @ftp_chdir($this->conn_id,"/"); if(!@ftp_mkdir($this->conn_id,$path)){ $ret=false; break; } } } return $ret; } http://php.net/manual/en/function.ftp-mkdir.php

« previous php.notes (#138502) next »