Reputation: 399
I want to verify if file/folder exists on my CI system (not system folder), can i do it from controller or I need create a method on my model to do it?
Upvotes: 0
Views: 683
Reputation: 6154
Best to add this function in a codeigniter helper or in a library class(if you are fan of OOP). Load this automatically with autoload.php and call from wherever you need it.
Upvotes: 0
Reputation: 7055
It's basically a matter of choice. You can define your function in both your model and controller. But if you want to use it over and over from different controllers, then better define a new model and put that function in it. I'd define model which is to be used by many controllers that is having some common-general methods. Just to keep things apart and maintaining them later. Helpers are also a way to keep things separate.
Upvotes: 1
Reputation: 2745
You have got many way for this :
verify()
You can create a private function into your controller like
private function _verify() { }
enjoy !
Upvotes: 0