public function createFolderAction($name)
{
if (!$this->isValidFilename($name)) {
return $this->error(__('Invalid file name.'));
}
if (!($path = $this->getPath($name))) {
return $this->error(__('Invalid path.'));
}
if (file_exists($this->getPath($name))) {
return $this->error(__('Folder already exists.'));
}
if ('w' !== $this->getMode(dirname($path))) {
throw new ForbiddenException(__('Permission denied.'));
}
try {
App::file()->makeDir($path);
return $this->success(__('Directory created.'));
} catch (\Exception $e) {
return $this->error(__('Unable to create directory.'));
}
}