示例#1
0
 function deleteFile($fileName)
 {
     return parent::deleteFile($this->filesDir . $fileName);
 }
 /**
  * Download a file.
  * @param $fileId int the file id of the file to download
  * @param $revision int the revision of the file to download
  * @param $inline boolean print file as inline instead of attachment, optional
  * @param $filename string The client-side download filename (optional)
  * @return boolean
  */
 function downloadFile($fileId, $revision = null, $inline = false, $filename = null)
 {
     $returner = false;
     $submissionFile = $this->_getFile($fileId, $revision);
     if (isset($submissionFile)) {
         // Make sure that the file belongs to the submission.
         if ($submissionFile->getSubmissionId() != $this->getSubmissionId()) {
             fatalError('Invalid file id!');
         }
         $this->recordView($submissionFile);
         // Send the file to the user.
         $filePath = $submissionFile->getFilePath();
         $mediaType = $submissionFile->getFileType();
         $returner = parent::downloadFile($filePath, $mediaType, $inline, $filename);
     }
     return $returner;
 }
 /**
  * Get the storage directory for simple monograph files.
  */
 function getBasePath()
 {
     return parent::getBasePath() . 'simple/';
 }