【发布时间】:2010-11-13 07:45:30
【问题描述】:
我知道网上有很多教程,但我无法让它们发挥作用 :( 可能是我的系统出了问题:/
我的控制器本地路径是: /localhost/rl/applications/后端/控制器/
控制器:
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('add_image', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$data['id'] = $this->input->post['id_work'];
$this->load->view('add_image', $data);
}
}
我的视图本地路径是: /localhost/rl/applications/backend/view/
查看:
echo form_open_multipart('do_upload');
<ul class="frm">
<li><label>File: *</label><input type="file" name="userfile" class="frmlmnt" size="50" /></li>
<li><label></label><input type="submit" class="btn" value="Upload" /></li>
</ul>
</form>
也许我的路径有问题
【问题讨论】:
标签: image codeigniter upload photo