/** * @param $params */ public function removeFile($params) { \Env::get('init')->loadLanguageData('MediaBrowser'); $path = !empty($params['get']['path']) ? contrexx_input2raw($params['get']['path']) : null; $filename = !empty($params['post']['file']['datainfo']['name']) ? contrexx_input2raw($params['post']['file']['datainfo']['name']) : null; if ($filename && $path) { $pathArray = explode('/', $path); // Shift off the first element of the array to get the media type. $mediaType = array_shift($pathArray); $strPath = '/' . join('/', $pathArray); $this->setMessage($this->cx->getMediaSourceManager()->getMediaType($mediaType)->getFileSystem()->removeFile(new \Cx\Core\MediaSource\Model\Entity\LocalFile($strPath . $filename))); } }