|
我的控制器代码是这样的:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Upload extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
}
function index()
{
$this->load->view('upload_view');
}
function add()
{
//var_dump($_FILES['upfiles']);exit;
$config['upload_path'] = "./upload/";
$config['allowed_types'] = "gif|jpg|png";
$config['max_size'] = "20000";
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library("upload", $config);
if($this->upload->do_upload('upfiles'))
{
$data = array('upload_data'=>$this->upload->data());
var_dump($data);
}
else
{
$error = array('error'=>$this->upload->display_errors());
var_dump($error);
}
}
}
upload_model代码是这样的:
<html>
<form action="/index.php/upload/add" method="post" enctype="multipart/form-data">
<input type="file" name="upfiles" />
<input type="submit" name="sub" value="上传" />
</form>
</html>
然后点击上传后,总是报这样的错The requested URL /index.php/upload/add was not found on this server.
检查了很多遍提交路径没错啊,可不知道怎么的就是提交不过去,求高手指出到底是哪里出错了啊,折腾了半天也没解决,不知道是不是要配置什么东西的原因。。
|
|