Codeigniter to get an extension of the file before upload then, i will help you to get a file extension in Codeigniter from the file name. we can get file extension using pathinfo() PHP function.


Example:

<?php
$fileName = $this->upload->data('image');
$fileExt = pathinfo($fileName, PATHINFO_EXTENSION);
  
print_r($fileExt);


I hope it can help you...