Hi friends,
I know there are many tutorials online, but I could not make them work :( maybe something particularly wrong with my system :/
My Controller localpath is: /localhost/rl/applications/backend/controller/
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);
}
}
My View localpath is: /localhost/rl/applications/backend/view/
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>
Maybe I do something wrong with path