getFileData(), true); if (empty($decodedContent)) { throw new InputException(__('Provided content must be valid base64 encoded data.')); } if (!$this->isFileNameValid($fileContent->getName())) { throw new InputException(__('Provided file name contains forbidden characters.')); } return true; } /** * Check if given filename is valid * * @param string $fileName * @return bool */ protected function isFileNameValid($fileName) { // Cannot contain \ / : * ? " < > | if (!preg_match('/^[^\\/?*:";<>()|{}\\\\]+$/', $fileName)) { return false; } return true; } }