I am creating an upload form using codeiginiter upload class to facilitate user uploading file (allowed .csv only). I want to force the users renaming their filename before they upload the csv by rejecting them if the filename is same.
$folder is my path (correctly set as I can retrieve the file and presented on another page);
$config[‘file_name’] is formed to >strtolower($_FILES[$field_name][‘name’]); resulting uploaded_user_file_name.csv as expected.
I set >$config[‘overwrite’] = TRUE; to avoid appending increment num at the end of filename.
if(file_exists($folder.'/'.$config['file_name']))
{
//$status['status'] = 0;
$message = 'Please rename your file';
$this->session->set_flashdata('flash_message', $message );
redirect('pengumuman-new', 'refresh');
}else{
//proceed to upload
}
HOWEVER, the code above resulting in processing the upload and overwriting the file.
Please help.
I had tried setting >$config[‘overwrite’] = FALSE; but it is not working.
I tried modifying the path (in case I mistakenly wrote the wrong path) but no solution too.