overwrite previous file while uploading image in codeigniter overwrite previous file while uploading image in codeigniter codeigniter codeigniter

overwrite previous file while uploading image in codeigniter


You should supply the overwrite config parameter

$config['upload_path'] = './uploads/';$config['overwrite'] = TRUE;$this->load->library('upload', $config);$this->upload->initialize($config);

See the Documentation for upload preferences

Preference: overwrite

Default Value: FALSE

Options: TRUE/FALSE (boolean)

Description: If set to true, if a file with the same name as the one you are uploading exists, it will be overwritten. If set to false, a number will be appended to the filename if another with the same name exists.