コード例 #1
0
ファイル: ComstockController.php プロジェクト: poykub/wph
 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]);
     }
 }
コード例 #2
0
ファイル: ComstockController-BAK.php プロジェクト: poykub/wph
 private function removeUploadDir($dir)
 {
     BaseFileHelper::removeDirectory(Comstock::getUploadPath() . $dir);
 }