public function actionApiRenameFile() { $this->_prepairJson(); $data = $this->_request->getParam('data'); $path = Yii::getPathOfAlias('webroot') . $data['dir']; if (!file_exists($path)) { mkdir($path); } if (rename($path . $data['name'], $path . '#trash#' . $data['name'])) { EventHelper::materialsDeleted($_GET['orderId']); $this->_response->setData(true); } else { $this->_response->setData(false); } $this->_response->send(); }