我正在开发一个项目,用户可以上传他用于前端 Web 开发的文件,并展示他所做的工作在浏览器中的外观。为此,我要求用户使用名为 test.html 的 html 文件上传项目。我为此目的使用了codeigniter。
我已经完成了上传过程并在表格中写入了信息,但是我被困在如何在文件完成上传后提供链接......即我有一个上传控制器,如下所示:
<?php class Main extends CI_Controller {
//{construct and all the parts}
//upload function
function site_pages(){
$this->load->view('header'); $this->load->view('nav'); $this->load->view('test.html');
}
function do_upload(){
.....code for file upload....
...update the database with the folder_id...
}
但是,完成此操作后,我需要向用户提供链接,即表单
<a href="<?php echo base_url();?>/main/site_pages/folder_id/test.html" >
我被困在如何以这种形式生成这个 id 以及如何在控制器的特定视图中加载 test.html 文件