[eluser]lizaaard[/eluser]
i'm having problems with my upload form... can anybody help me.. i've searched the complete forum trying to find an answer.. and i cannot find anything helpful..
here's my controller code:
Code:
<?php
class Upload_files extends Controller {
function Upload_files(){
parent::Controller();
$this->load->helper(array('form', 'url'));
}
function index(){
$this->load->view('admin/upload_form', array('error' => ' ' ));
}
function do_upload()
{
$config['upload_path'] = './assets/';
$config['allowed_types'] = 'gif|jpg|png';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('admin/upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('admin/upload_success', $data);
}
}
}
here's my view file:
Code:
<head>
<title>File Uploads</title>
</head>
<body>
<?php echo $error;?>
<form method="post" action="upload_files/do_upload" enctype="multipart/form-data" />
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="upload" />
</form>
</body>
</html>
the problem is that the form allways give me this error:
Code:
You did not select a file to upload.
i've tried everything... and i cannot figure how to fix this problem =(
the upload path exists... and the input field it's named userfile...
sorry for my english... i'm from argentina.. and i'm very new at PHP / CI..
thanks for your help =)