I\'m trying to add time as the prefix of the image name along with the original name when uploading, But I couldn\'t figure it out. Please help me with the following code to
Try This:
$config['file_name'] = "yourCustomFileName";
If your $config
is with this code: $config['encrypt_name'] = TRUE;
the name of your file will be forced to rename with a encrypt name, just remove the code.
when you use do_upload() function its rename file name if already exists and upload file
System->libraries->Upload.php
default function of do_upload() return true or false replace
return $this->upload_path.$this->file_name;
and in another file
<input type='file' name='userfile'/>
<?php
$upload_file_name = $this->upload->do_upload('userfile');
$finalname;
if (!$upload_file_name) {
$finalname = 'default.png';
} else {
$split_data_upload_file_name = explode("/", $upload_file_name);
foreach ($split_data_upload_file_name as $i => $value) {
$finalname = $value;
}
}
?>