function mkdir($dir, $mode = 0777, $recursive = true) { if (TextUtils::endsWith($dir, 'test/dir/mkdirfails')) { return false; } if (TextUtils::endsWith($dir, 'test/dir/mkdirpass')) { return true; } return \mkdir($dir, $mode, $recursive); }
/** * {@inheritDoc} */ public function upload($file, $destination, array $options = array()) { if (!is_file($file)) { throw new \RuntimeException('Unable to upload; File ' . $file . ' does not exists.'); } $fileName = basename($file); if ($destination) { if (TextUtils::endsWith($destination, '/')) { $destination = $destination . $fileName; } } else { $destination = $fileName; } $savePath = $this->normalizePath($destination, true); $this->verifyPathExists(dirname($savePath), true); $this->chdir(dirname($savePath)); $result = ftp_put($this->connection(), basename($savePath), $file, FTP_BINARY); $this->chdir($this->path); return $result === false ? false : $this->normalizePath($destination, false, false); }