jeudi 18 septembre 2014

image uploading is not working in codeignitor


Vote count:

0




here is my controller `



class Import_data extends CI_Controller
{
function __construct()
{
parent::__construct();
//$this->load->helper('url');
//$this->load->helper('form');
$this->load->library('upload');
}
function index()
{

}
function image_upload()
{

$config['upload_path'] = './upload';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['file_name'] = 'photo_' . substr(md5(time()), 0, 16);
$image = 'aaa';
$this->upload->initialize($config);
if (!$this->upload->do_upload($image))
{
$error = array('error' => $this->upload->display_errors());
print_r($error);die;
$this->load->view('home_view', $error);

}
else
{
$data = $this->upload->data();
print_r($data);die;
$this->load->view('upload_success', $data);
}
}
}
`


i tried to print error message which prints ` Array ( [error] =>



You did not select a file to upload.
)
`


i don't know what wrong in my code i am selecting file properly here is my view code



`<form name="" method="post" action="<?php echo site_url('import_data/image_upload');?>" enctype="multipart/form-data">
<input type="file" name="excel_file" /> <br/><br/>
<input type="submit" name="submit" value="Submit">
<?php //echo $error;?>
<br/>
<?php //echo $upload_data;?>
</form>`


please help thanks in advance



asked 29 secs ago







image uploading is not working in codeignitor

Aucun commentaire:

Enregistrer un commentaire