public function actionDeletefileAjax() { $model = Uploads::findOne(Yii::$app->request->post('key')); if ($model !== NULL) { $filename = Comstock::getUploadPath() . $model->ref . '/' . $model->real_filename; $thumbnail = Comstock::getUploadPath() . $model->ref . '/thumbnail/' . $model->real_filename; if ($model->delete()) { @unlink($filename); @unlink($thumbnail); echo json_encode(['success' => true]); } else { echo json_encode(['success' => false]); } } else { echo json_encode(['success' => false]); } }
private function removeUploadDir($dir) { BaseFileHelper::removeDirectory(Comstock::getUploadPath() . $dir); }