ci文件上传类为什么老提示路径不对啊,我的路径写的很明白
控制器<?php
class Upload extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('upload');
$this->upload->do_upload();
}
function index()
{
$this->load->view('upload_form', array('error' => ' ' ));
}
function do_upload()
{
$config['upload_path'] = 'http://localhost/updata/uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width']= '1024';
$config['max_height']= '768';
print_r($config['upload_path']);
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
}
?>
错误提示:
http://localhost/updata/uploads/
The upload path does not appear to be valid.
The upload path does not appear to be valid.
上面的路径是我用print_r打印出来的
http://localhost/updata/uploads/
是URL不是路径
x:/updata/uploads/
../uploads/
这样的才是路径
楼上正解 huboo82 发表于 2012-4-25 13:01 static/image/common/back.gif
http://localhost/updata/uploads/
是URL不是路径
x:/updata/uploads/
那我直接把Windows下的文件夹路径粘上去是不是就行了? huboo82 发表于 2012-4-25 13:01 static/image/common/back.gif
http://localhost/updata/uploads/
是URL不是路径
x:/updata/uploads/
按照你说的写也不对啊 huboo82 发表于 2012-4-25 13:01 static/image/common/back.gif
http://localhost/updata/uploads/
是URL不是路径
x:/updata/uploads/
E:/wamp/www/updata/uploads/
The upload path does not appear to be valid.
The upload path does not appear to be valid.
错误报告 function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('upload');
$this->upload->do_upload();
}
中的
$this->load->library('upload');
删了,肯定就好了,细节很重要。 还是不对,,,,, 情愿接受怪兽的 发表于 2012-4-26 16:43 static/image/common/back.gif
还是不对,,,,,
把你的代码打包发上来,不要只发一点,要全部。 Hex 发表于 2012-4-26 17:21 static/image/common/back.gif
把你的代码打包发上来,不要只发一点,要全部。
页:
[1]
2