uploadSubmissionFile() public method

Upload a submission file.
public uploadSubmissionFile ( $fileName, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile
$fileName string the name of the file used in the POST form
$fileStage int submission file workflow stage
$uploaderUserId int The id of the user that uploaded the file.
$uploaderUserGroupId int The id of the user group that the uploader acted in when uploading the file.
$revisedFileId int
$genreId int (e.g. Manuscript, Appendix, etc.)
return SubmissionFile
 /**
  * Upload the file in an app-specific manner.
  * @param PKPRequest $request
  * @param PKPUser $user
  * @param $uploaderUserGroupId int
  * @param $revisedFileId int
  * @param $fileGenre int
  * @param $assocType int
  * @param $assocType int
  * @return SubmissionFile
  */
 function _uploadFile($request, $user, $uploaderUserGroupId, $revisedFileId, $fileGenre, $assocType, $assocId)
 {
     $context = $request->getContext();
     import('lib.pkp.classes.file.SubmissionFileManager');
     $articleFileManager = new SubmissionFileManager($context->getId(), $this->getData('submissionId'));
     $fileStage = $this->getData('fileStage');
     $submissionFile = $articleFileManager->uploadSubmissionFile('uploadedFile', $fileStage, $user->getId(), $uploaderUserGroupId, $revisedFileId, $fileGenre, $assocType, $assocId);
     return $submissionFile;
 }
 /**
  * Save the submission file upload form.
  * @see Form::execute()
  * @param $request Request
  * @return SubmissionFile if successful, otherwise null
  */
 function execute($request)
 {
     // Identify the file genre and category.
     $revisedFileId = $this->getRevisedFileId();
     if ($revisedFileId) {
         // The file genre and category will be copied over from the revised file.
         $fileGenre = null;
     } else {
         // This is a new file so we need the file genre and category from the form.
         $fileGenre = $this->getData('genreId') ? (int) $this->getData('genreId') : null;
     }
     // Retrieve the uploader's user group.
     $uploaderUserGroupId = $this->getData('uploaderUserGroupId');
     if (!$uploaderUserGroupId) {
         fatalError('Invalid uploader user group!');
     }
     // Identify the uploading user.
     $user = $request->getUser();
     assert(is_a($user, 'User'));
     $assocType = $this->getData('assocType') ? (int) $this->getData('assocType') : null;
     $assocId = $this->getData('assocId') ? (int) $this->getData('assocId') : null;
     $fileStage = $this->getData('fileStage');
     // Upload the file.
     import('lib.pkp.classes.file.SubmissionFileManager');
     $submissionFileManager = new SubmissionFileManager($request->getContext()->getId(), $this->getData('submissionId'));
     $submissionFile = $submissionFileManager->uploadSubmissionFile('uploadedFile', $fileStage, $user->getId(), $uploaderUserGroupId, $revisedFileId, $fileGenre, $assocType, $assocId);
     if (!$submissionFile) {
         return null;
     }
     // Log the event.
     import('lib.pkp.classes.log.SubmissionFileLog');
     import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
     // constants
     SubmissionFileLog::logEvent($request, $submissionFile, $revisedFileId ? SUBMISSION_LOG_FILE_REVISION_UPLOAD : SUBMISSION_LOG_FILE_UPLOAD, $revisedFileId ? 'submission.event.revisionUploaded' : 'submission.event.fileUploaded', array('fileStage' => $fileStage, 'revisedFileId' => $revisedFileId, 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $this->getData('submissionId'), 'username' => $user->getUsername()));
     return $submissionFile;
 }