[eluser]adekenny[/eluser]
Hi,
I really need help fast, there's this project i'm working on and i'm trying to incorporate a page that allows users to upload images to a directory. The problem is that it's just not working at all. I'v checked the code with the example on the user guide that there seems to be no problem with it.
When i clicked the upload buttom it just wasn't giving any response at all - no even any error message.
What are my not getting right?
please see my controller code below.
<?php
class Upload extends Controller
{
var $base;
var $css;
var $my_menu;
function Upload()
{
parent::Controller();
$this->base = $this->config->item('base_url');
$this->css = $this->config->item('css');
$this->load->library('menu');
$this->my_menu = $this->menu->show_menu();
$this->load->library('upload');
$this->load->library('session');
$this->load->helper(array('form', 'url'));
}
function do_upload()
{
if(!$this->upload->do_upload())
{
$data['menu'] = $this->my_menu;
$data['base'] = $this->base;
$data['css'] = $this->css;
$error = array('error' => $this->upload->display_errors());
$data['error'] = $error;
$this->load->view('photo_upload_failed', $data);
}
else
{
$data['menu'] = $this->my_menu;
$data['base'] = $this->base;
$data['css'] = $this->css;
$data = array ('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
}
?>
I've already created a file in my config folder where i set all the default settings. Please see below.
<?php
if(!defined('BASEPATH'))
{
exit;
}
else
{
$config['upload_path'] = 'uploads';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '40';
$config['max_width'] = '50';
$config['max_height'] = '60';
$config['remove_spaces'] = TRUE;
}
?>
Many Thanks
adekenny - Nigeria