parseFileExtension($articleFile->getFileName()); if (!$this->fileExists($this->getBasePath(), 'dir')) { // Try to create destination directory $this->mkdirtree($this->getBasePath()); } $newFileName = basename(tempnam($this->getBasePath(), $fileExtension)); if (!$newFileName) return false; if (copy($articleFile->getFilePath(), $this->getBasePath() . $newFileName)) { $temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO'); $temporaryFile = $temporaryFileDao->newDataObject(); $temporaryFile->setUserId($userId); $temporaryFile->setFileName($newFileName); $temporaryFile->setFileType($articleFile->getFileType()); $temporaryFile->setFileSize($articleFile->getFileSize()); $temporaryFile->setOriginalFileName($articleFile->getOriginalFileName()); $temporaryFile->setDateUploaded(Core::getCurrentDate()); $temporaryFileDao->insertTemporaryFile($temporaryFile); return $temporaryFile; } else { return false; } } } ?>