CC-3426: apache log errors from plupload

- Updated code so the errors in the log are fixed.
- Performed sanity test on large file size that exceed disk space
  and normal uploads that are small enough to be copied
This commit is contained in:
Daniel 2012-03-14 11:14:22 -04:00
parent d25a6b7b6b
commit f399c7adab
2 changed files with 13 additions and 16 deletions

View File

@ -5,10 +5,10 @@ class PluploadController extends Zend_Controller_Action
public function init() public function init()
{ {
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('upload', 'json') $ajaxContext->addActionContext('upload', 'json')
->addActionContext('copyfile', 'json') ->addActionContext('copyfile', 'json')
->initContext(); ->initContext();
} }
public function indexAction() public function indexAction()
@ -19,10 +19,10 @@ class PluploadController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/plupload.queue.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/plupload.queue.css?'.$CC_CONFIG['airtime_version']);
} }
public function uploadAction() public function uploadAction()
@ -31,7 +31,7 @@ class PluploadController extends Zend_Controller_Action
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir); $tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
$tempFileName = basename($tempFilePath); $tempFileName = basename($tempFilePath);
die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }'); die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }');
} }
public function copyfileAction(){ public function copyfileAction(){
@ -39,14 +39,12 @@ class PluploadController extends Zend_Controller_Action
$filename = $this->_getParam('name'); $filename = $this->_getParam('name');
$tempname = $this->_getParam('tempname'); $tempname = $this->_getParam('tempname');
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $filename, $tempname); $result = Application_Model_StoredFile::copyFileToStor($upload_dir, $filename, $tempname);
if (isset($result)){ if (isset($result))
die('{"jsonrpc" : "2.0", "error" : {"code": '.$result[code].', "message" : "'.$result[message].'"}}'); die('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}');
}
die('{"jsonrpc" : "2.0"}'); die('{"jsonrpc" : "2.0"}');
} }
} }

View File

@ -778,14 +778,13 @@ Logging::log("getting media! - 2");
//check to see if we have enough space in the /organize directory to copy the file //check to see if we have enough space in the /organize directory to copy the file
$freeSpace = disk_free_space($destination_folder); $freeSpace = disk_free_space($destination_folder);
$fileSize = filesize($audio_file); $fileSize = filesize($audio_file);
if ( $freeSpace < $fileSize){ if ( $freeSpace < $fileSize){
$freeSpace = ceil($freeSpace/1024/1024); $freeSpace = ceil($freeSpace/1024/1024);
$fileSize = ceil($fileSize/1024/1024); $fileSize = ceil($fileSize/1024/1024);
$result = array("code" => 107, "message" => "The file was not uploaded, there is ".$freeSpace."MB of disk space left and the file you are uploading has a size of ".$fileSize."MB."); return array("code" => 107, "message" => "The file was not uploaded, there is ".$freeSpace."MB of disk space left and the file you are uploading has a size of ".$fileSize."MB.");
} }
return $result;
} }
public static function copyFileToStor($p_targetDir, $fileName, $tempname){ public static function copyFileToStor($p_targetDir, $fileName, $tempname){