/** * Check a given upload path to see if it is 'public' or 'private' access, create if required. * * @param $path * * @return boolean */ private function checkUploadDirectory($path) { if ($this->filesystem->has($path)) { return $this->filesystem->getVisibility($path) === 'public'; } try { $this->filesystem->createDir($path); return $this->filesystem->getVisibility($path) === 'public'; } catch (IOException $e) { return false; } }
/** * Check a given upload path to see if it is 'public' or 'private' access, create if required. * * @param $path * * @return boolean */ private function checkUploadDirectory($path) { if (strpos('://', $path) === false) { $path = sprintf('files://%s', $path); } if ($this->filesystem->has($path)) { return $this->filesystem->getVisibility($path) === 'public'; } try { $this->filesystem->createDir($path); return $this->filesystem->getVisibility($path) === 'public'; } catch (IOException $e) { return false; } }