我試圖讓用戶配置文件和笨新增個人資料相片的功能,我的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