[eluser]dimasVS[/eluser]
Hi All,
I need your help,
I want to separate the directory when the image is uploaded, I want to put "image" in "uploads" directory and "image_thumb" in "upload_thumb" directory..
This is my script :
Code:
function do_upload(){
$n = rand(0,100000);
$nama_file = $_FILES['userfile']['name'];
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['encrypt_name'] = "$n";
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('admin/employeeAdd', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$image_data = $this->upload->data();
$file_name = $image_data['file_name'];
$this->Model_admin->imageUpload($file_name);
$config['image_library'] = "gd2";
$config['source_image'] = "./uploads/$file_name";
$config['create_thumb'] = TRUE;
$config['maintain_ration'] = TRUE;
$config['width'] = 50;
$config['height'] = 50;
// in here I put the second of $config['upload_path']
$this->load->library('image_lib', $config);
$this->image_lib->resize();
echo "Register Successfull<br />";
echo anchor('admin/employee', 'Back');
}
}
how to change the path ?
I've been trying by put $config['upload_path'] after image uploaded but always failed..
Thanks for your help !