I need full code , where i could upload full image size in the database (not only image path but whole image size). Thank you in advance
To upload Images or files you use following code to your controller as
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('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
Refferecne:Codeigniter Files upload guideline
How ever if you want to upload image using Ajax then please don't forget to knock then i will give entire codes blocks.
Thank you!
Are you trying to convert the image into bytes and save it on MYSQL database? If yes, then try this code
<?php
$filename = "image.png";
$file = fopen($filename, "rb");
$contents = fread($file, filesize($filename));
fclose($file);
?>