/** * Creates a new file * * previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_newfile() * * @param string $fileName The name of the file to be created * @param Folder $targetFolderObject The target folder where the file should be created * * @throws Exception\IllegalFileExtensionException * @throws Exception\InsufficientFolderWritePermissionsException * @return FileInterface The file object */ public function createFile($fileName, Folder $targetFolderObject) { $this->assureFileAddPermissions($targetFolderObject, $fileName); $newFileIdentifier = $this->driver->createFile($fileName, $targetFolderObject->getIdentifier()); $this->emitPostFileCreateSignal($newFileIdentifier, $targetFolderObject); return ResourceFactory::getInstance()->getFileObjectByStorageAndIdentifier($this->getUid(), $newFileIdentifier); }