In this tutorial, i will show you get extension from filename codeigniter. let’s discuss about get file extension in codeigniter from file name. it's simple example of codeigniter get extension of file. you can understand a concept of get file extension php codeigniter.
I was new to codeigniter application. i was using codeigniter 3 version. i was doing image upload task on my project and i need to make custom name of image when you upload on my server. At that time need to get image file extension from name and then i will rename it form extension. i search a lot about to getting directly for file extension but it was not there in codeigniter docs. i thought and find way to do it using php pathinfo().
I created simple example for getting file extension in codeigniter project. so you can see both example, i hope it can help you.
$fileExt = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
$fileName = $this->upload->data('image');
$fileExt = pathinfo($fileName, PATHINFO_EXTENSION);
I hope it can help you...
Do you like below Tutorials ?
- Laravel 7.x and 6.x Ajax Multiple Image Upload with Preview Example
- Laravel select with count(*) using db raw example
- PHP Laravel select with join subquery example
- PHP Laravel Ajax Form Submit Example
- How to create events for created/updated/deleted model task in Laravel 5?
- Angular JS Form Validation Example Code
- AngularJS - Confirm Password Validation Example
- Laravel Ajax Request using X-editable bootstrap Plugin Example