Beispiel #1
0
 /**
  * Move the uploaded file
  * @param unknown_type $fileData
  */
 protected function handleMoveFile($fileData)
 {
     KalturaLog::info("Moving the uploaded file");
     // get the upload path
     $extension = strtolower(pathinfo($fileData['name'], PATHINFO_EXTENSION));
     $uploadFilePath = $this->getUploadPath($this->_uploadToken->getId(), $extension);
     $this->_uploadToken->setUploadTempPath($uploadFilePath);
     myContentStorage::fullMkdir($uploadFilePath);
     $moveFileSuccess = move_uploaded_file($fileData['tmp_name'], $uploadFilePath);
     if (!$moveFileSuccess) {
         $msg = "Failed to move uploaded file for token id [{$this->_uploadToken->getId()}]";
         KalturaLog::log($msg . ' ' . print_r($fileData, true));
         throw new kUploadTokenException($msg, kUploadTokenException::UPLOAD_TOKEN_FAILED_TO_MOVE_UPLOADED_FILE);
     } else {
         KalturaLog::info("The file was moved successfully");
     }
     chmod($uploadFilePath, 0777);
 }
Beispiel #2
0
 /**
  * Move the uploaded file
  * @param unknown_type $fileData
  */
 protected function handleMoveFile($fileData)
 {
     // get the upload path
     $extension = strtolower(pathinfo($fileData['name'], PATHINFO_EXTENSION));
     // in firefox html5 upload the extension is missing (file name is "blob") so try fetching the extesion from
     // the original file name that was passed to the uploadToken
     if ($extension === "" || $extension == "tmp" && $this->_uploadToken->getFileName()) {
         $extension = strtolower(pathinfo($this->_uploadToken->getFileName(), PATHINFO_EXTENSION));
     }
     $uploadFilePath = $this->getUploadPath($this->_uploadToken->getId(), $extension);
     $this->_uploadToken->setUploadTempPath($uploadFilePath);
     kFile::fullMkdir($uploadFilePath, 0700);
     $moveFileSuccess = kFile::moveFile($fileData['tmp_name'], $uploadFilePath);
     if (!$moveFileSuccess) {
         $msg = "Failed to move uploaded file for token id [{$this->_uploadToken->getId()}]";
         KalturaLog::log($msg . ' ' . print_r($fileData, true));
         throw new kUploadTokenException($msg, kUploadTokenException::UPLOAD_TOKEN_FAILED_TO_MOVE_UPLOADED_FILE);
     }
     chmod($uploadFilePath, 0600);
 }