我想从我的数据库中删除和下载一个上传文件我已经上传并现在显示它我想下载和删除 iupload 的文件这是我的控制器 showupload.php
<?php class Showupload extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
}
function index()
{
$this->load->model('showuploadmodel');
$data['query']=$this->showuploadmodel->showfile();
$this->load->view('showupload_view',$data);
}
public function delete_upload($file_id) {
$this->load->showupload('showuploadmodel');
$data = $this->showuploadmodel->delete($file_id);
$this->load->view('showupload_view',$data);
}
public function download($filelink)
{
$this->load->helper('download');
$data = file_get_contents("$filelink"); // Read the file's link
force_download($filelink, $data);
}
}
?>
这是我的观点 show_upload_view.php
<?php include_once('header.php'); ?>
<?php include_once('tnavbar.php'); ?>
<html>
<head>
<title>Show Upload</title>
</head>
<body>
<div class='well'>
<table border="0">
<tr>
<th><h1>File Name</h1></th>
<th><h1>Date</h1></th>
<th><h1>Action</h1></th>
</tr>
<?php
foreach($query as $row){
echo "<tr>";
echo "<td><h2>". $row->filename ."</h2></td>";
echo "<td><h2>". $row->date ."</h2></td>";
echo "<td><h2>".Download|Delete."</h2></td>";
//now how can i make download and delete from my database
//my database contains filename,fileid,filelink
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>
现在我如何从我的数据库中下载和删除我的数据库包含文件名、文件 ID、文件链接