我试图让用户配置文件和笨新增个人资料相片的功能,我的simpy复制粘贴在文档中提供的文件上传代码,但它显示error.my视图文件是错误在上传图像文件
<?php echo form_open_multipart('upload/do_upload');?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="upload" />
我控制器
<?php
class Upload extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('upload');
}
public function do_upload()
{
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if (! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
echo'not happening';
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
}
?>
它显示在这里的错误,我的意思是呼应“没有发生”,这意味着它不uploading.if有人能请帮助我,这将是巨大的。
什么错误是它展示? –
[为什么“有人能帮助我吗?”不是一个实际的问题?(http://meta.stackoverflow.com/q/284236) –
是否web服务器对该文件夹的写权限,它被上传到?大概有90%的机会它不,这是相关 – gabe3886