Ejemplo n.º 1
0
 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]);
     }
 }
Ejemplo n.º 2
0
 private function removeUploadDir($dir)
 {
     BaseFileHelper::removeDirectory(Comstock::getUploadPath() . $dir);
 }