diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 8d9d1d8f4..a46367c9d 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -573,8 +573,9 @@ class ApiController extends Zend_Controller_Action Application_Model_Preference::SetImportTimestamp(); if ($mode == "create") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); - $filepath = str_replace("//", "/", $filepath); + //$filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("//", "/", $filepath); + $filepath = Application_Common_OsPath::normpath($filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { @@ -595,7 +596,7 @@ class ApiController extends Zend_Controller_Action } else if ($mode == "modify") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); //File is not in database anymore. @@ -618,13 +619,13 @@ class ApiController extends Zend_Controller_Action } else { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $file->setFilePath($filepath); } } else if ($mode == "delete") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { @@ -637,7 +638,7 @@ class ApiController extends Zend_Controller_Action } else if ($mode == "delete_dir") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $files = Application_Model_StoredFile::RecallByPartialFilepath($filepath); foreach($files as $file){ diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 909351d3c..6e34f10a6 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -40,7 +40,7 @@ class PluploadController extends Zend_Controller_Action $tempname = $this->_getParam('tempname'); $result = Application_Model_StoredFile::copyFileToStor($upload_dir, $filename, $tempname); if (!is_null($result)) - die('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}'); + die('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}'); die('{"jsonrpc" : "2.0"}'); }