diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 0f94ca2ed..82246ff5e 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -5,10 +5,10 @@ class PluploadController extends Zend_Controller_Action public function init() { - $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext->addActionContext('upload', 'json') - ->addActionContext('copyfile', 'json') - ->initContext(); + $ajaxContext = $this->_helper->getHelper('AjaxContext'); + $ajaxContext->addActionContext('upload', 'json') + ->addActionContext('copyfile', 'json') + ->initContext(); } public function indexAction() @@ -19,10 +19,10 @@ class PluploadController extends Zend_Controller_Action $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/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/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->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() @@ -31,7 +31,7 @@ class PluploadController extends Zend_Controller_Action $tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir); $tempFileName = basename($tempFilePath); - die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }'); + die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }'); } public function copyfileAction(){ @@ -39,14 +39,12 @@ class PluploadController extends Zend_Controller_Action $filename = $this->_getParam('name'); $tempname = $this->_getParam('tempname'); $result = Application_Model_StoredFile::copyFileToStor($upload_dir, $filename, $tempname); - if (isset($result)){ - die('{"jsonrpc" : "2.0", "error" : {"code": '.$result[code].', "message" : "'.$result[message].'"}}'); - } + if (isset($result)) + die('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}'); + die('{"jsonrpc" : "2.0"}'); } } - - diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 30f9054a7..7fd3714d5 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -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 $freeSpace = disk_free_space($destination_folder); $fileSize = filesize($audio_file); - + if ( $freeSpace < $fileSize){ $freeSpace = ceil($freeSpace/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){