我知道网上有很多教程,但我无法让它们发挥作用:(也许我的系统特别有问题:/
我的控制器本地路径是:/localhost/rl/applications/backend/controller/
控制器:
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>
也许我在路径上做错了什么