public function make_collection($path)
{
$path = $this->get_encoded_path($path);
if (false === ($conn = $this->get_connection_handle())) {
throw new Exception("Could not connect to FTP server.");
}
if ('/' == $path[0]) {
$path = substr($path, 1);
}
if ('/' == substr($path, -1)) {
$path = substr($path, 0, -1);
}
$path_parts = explode('/', $path);
for ($i = 0; $i < sizeof($path_parts) - 1; $i++) {
if (false === @ftp_chdir($conn, $path_parts[$i])) {
$this->throw_exception("Could not change to directory `{$path_parts[$i]}'.");
}
}
$label = $path_parts[sizeof($path_parts) - 1];
if (false === @ftp_mkdir($conn, $label)) {
$this->throw_exception("Could not make directory `{$label}'.");
}
@ftp_close($conn);
return true;
}