In codeigniter ,file uploader has a default class.We just have to define the folder,file name .
Example:
function myupload()
{
$file="photo";
$config['upload_path']="assets/posts";
$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($file))
{
//error statement goes here
}
else
{
$this->upload->data();
}
}
Example:
function myupload()
{
$file="photo";
$config['upload_path']="assets/posts";
$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($file))
{
//error statement goes here
}
else
{
$this->upload->data();
}
}
Social Plugin