CodeIgniter Forums
Need help in file upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Need help in file upload (/showthread.php?tid=47720)



Need help in file upload - El Forum - 12-19-2011

[eluser]Unknown[/eluser]
Hi all,

I am beginner in codigniter.
I am facing problem in uploading the files.

I attaching my code her.

Please let me know where i am doing any wrong.
Code:
$PHOTOPATH=$_SERVER['DOCUMENT_ROOT'].'/resources/store/photo/';
$config = array(
'allowed_types' => 'jpg|jpeg|gif|png',
'upload_path' => $PHOTOPATH.'original/',
'file_name' => time(),
'max_size' => 5242880
);

$this->load->library('upload', $config);

$field_name = "Filedata";

$this->upload->do_upload($field_name);
$eimage = $this->upload->data();
////this end for file upload
//// Now started the file resize code here
  
$evimg = $eimage['file_name'];
$config['source_image'] = $eimage['full_path'];
$config['new_image'] = $PHOTOPATH. '140X100/';
$config['width'] = 140;
$config['height'] = 100;
$config['maintain_ratio'] = true;
$config['master_dim'] = 'width';
$config['create_thumb'] = FALSE;
$this->image_lib->initialize($config);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
//// Now file resize code end here

Any help is best for me.

Waiting any quick response from you guys.

thanks in advance.