/**
  * 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;
 }
예제 #2
0
 function downloadFile($filePath, $fileType, $inline = false)
 {
     return parent::downloadFile($this->filesDir . $filePath, $fileType, $inline);
 }