Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my upload_form.php which is in application/view/upload_form.php and code:
<html>
<head>
<title> upload form </title>
</head>
<body>


<input type='file' name='userfile' size='20' />


<input type='submit' value='Upload' />
</form>
</body>
</html>

this is my success page of upload_success.php which in application/view/upload_success.php and it's code:

<html>
<head>
<title> success upload </title>
</head>
<body>

your file was successfully uploaded!



    $value):?>
  • :



</body>
</html>


and this is controller page upload.php which is in application/controller/upload.php and code:

class upload extends CI_Controller
{
public function _construct()
{
parent::construct();
$this->load->helper(array('form','url'));
}

public function index()
{
$this->load->view('upload_form',array('error'=>''));
}
public 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('userfile'))
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());

$this->load->view('upload_success', $data);
}
}
}
?>

and executes on url of browser the error is that the upload_form.php page not found. and not load that page and i don't understand that what kind of configuration at upload folder .if any kind of mistakes that i did or any way for better guidence. thank u for help.
Posted
Updated 10-Dec-15 17:01pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900