| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/Topogeo/ojs/classes/file/ |
Upload File : |
<?php
/**
* @file classes/file/PublicFileManager.inc.php
*
* Copyright (c) 2003-2012 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class PublicFileManager
* @ingroup file
*
* @brief Wrapper class for uploading files to a site/journal's public directory.
*/
// $Id$
import('lib.pkp.classes.file.PKPPublicFileManager');
class PublicFileManager extends PKPPublicFileManager {
/**
* Get the path to a journal's public files directory.
* @param $journalId int
* @return string
*/
function getJournalFilesPath($journalId) {
return Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId;
}
/**
* Upload a file to a journals's public directory.
* @param $journalId int
* @param $fileName string the name of the file in the upload form
* @param $destFileName string the destination file name
* @return boolean
*/
function uploadJournalFile($journalId, $fileName, $destFileName) {
return $this->uploadFile($fileName, $this->getJournalFilesPath($journalId) . '/' . $destFileName);
}
/**
* Write a file to a journals's public directory.
* @param $journalId int
* @param $destFileName string the destination file name
* @param $contents string the contents to write to the file
* @return boolean
*/
function writeJournalFile($journalId, $destFileName, &$contents) {
return $this->writeFile($this->getJournalFilesPath($journalId) . '/' . $destFileName, $contents);
}
/**
* Copy a file to a journals's public directory.
* @param $journalId int
* @param $sourceFile string the source of the file to copy
* @param $destFileName string the destination file name
* @return boolean
*/
function copyJournalFile($journalId, $sourceFile, $destFileName) {
return $this->copyFile($sourceFile, $this->getJournalFilesPath($journalId) . '/' . $destFileName);
}
/**
* Delete a file from a journal's public directory.
* @param $journalId int
* @param $fileName string the target file name
* @return boolean
*/
function removeJournalFile($journalId, $fileName) {
return $this->deleteFile($this->getJournalFilesPath($journalId) . '/' . $fileName);
}
}
?>