Try this ... it's just a very simple solution to your problem. If you notice that CI has a base_path definition for your directory, for example. in the download library configuration:
$imagePath = './picture/Temporary Profile Picture/'; $config['upload_path'] = $imagePath; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $this->load->library('upload', $config);
if you notice that upload_path is set to .. / picture / Temporary Profile Picture / '
therefore, if you want to remove a file from the directory, all you have to do is use the unlink () function.
unlink($imagePath . $file_name);
or
@unlink($imagePath . $file_name);
Enjoy .. ^^
source share