public static function contentDir($id) { $path = "data/"; //images $img = $path . "i/" . $id; ZHelper::deleteDir($img); //file $file = $path . "f/" . $id; ZHelper::deleteDir($file); //video $video = $path . "v/" . $id; ZHelper::deleteDir($video); return true; }
public function deletefile() { $req = App::request(); $jsonData = array(); $jsonData["result"] = null; if ($req->isPost()) { try { $post = $req->post(); $jsonData["fileid"] = $post['fileid']; if (ZHelper::contentDir($post['fileid'])) { $jsonData["msg"] = "The file " . $post['fileid'] . " has been delete"; $jsonData["result"] = "ok"; } else { $jsonData["msg"] = "failed remove directory"; } } catch (Exception $e) { $jsonData["msg"] = $e->getMessage(); } echo json_encode($jsonData); } }