用户
 找回密码
 入住 CI 中国社区
搜索
查看: 9806|回复: 1
收起左侧

codeigniter文件上传类为什么还是不能上传html和doc呢?

[复制链接]
发表于 2012-2-21 11:01:04 | 显示全部楼层 |阅读模式
我看过mimes.php里面明明有'html'    =>    'text/html' 而且我用firebug看'Content-Type' 也是'text/html'
PHP复制代码
     
       $config['upload_path'] = './uploads/';
        $config['allowed_types'] = '*';
        $config['max_size'] = '0';
        $this->load->library('upload');
       
        //$field_name = "template_file";
        $this->upload->initialize($config);
        if($this->upload->do_upload()){        
            $startnums = $this->input->post('startnums');
            $endnums = $this->input->post('endnums');
            $uploaded = $this->upload->data();
            print_r($uploaded);
        }else{
            echo $this->upload->display_errors();            
            $this->load->view('welcome_message');
        }
        print_r($_FILES);
        echo '<br>';
        print_r($this->upload->data());
 
复制代码

HTML复制代码
 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>
 
<form method="post" action="" enctype="multipart/form-data" />
<label for='startnums'>开始数字</label>
<input type='text' name='startnums'/>
<label for='endnums'>结束数字</label>
<input type='text' name='endnums'/>
<label for='endnums'>模板</label>
<input type='file' name='userfile'/>
<input type='submit' value='提交'/>
</form>
</body>
</html>
 
复制代码

最后只能把allowed_types改成'*'才行。。。那就是说allowd_types失效这就不能限制用户了。。。
 楼主| 发表于 2012-2-25 09:07:12 | 显示全部楼层
有人知道这是什么问题吗?

本版积分规则