yanqing 发表于 2012-2-21 11:01:04

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

我看过mimes.php里面明明有'html'    =>    'text/html' 而且我用firebug看'Content-Type' 也是'text/html'
   
       $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());



<!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失效这就不能限制用户了。。。

yanqing 发表于 2012-2-25 09:07:12

有人知道这是什么问题吗?
页: [1]
查看完整版本: codeigniter文件上传类为什么还是不能上传html和doc呢?