![]() |
Is_dir and Is_file inside foreach loop error. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Is_dir and Is_file inside foreach loop error. (/showthread.php?tid=67557) |
Is_dir and Is_file inside foreach loop error. - wolfgang1983 - 03-09-2017 I am getting error in my foreach loop using Array to string conversion error. On the line where is_dir and is_file. Question: Where have I gone wrong? How to fix it? Seems to be if any files in sub folder throws the error that's what causing error. PHP Code: foreach ($files as $image) { Controller function PHP Code: public function index() { RE: Is_dir and Is_file inside foreach loop error. - PaulD - 03-09-2017 Perhaps your directory map is returning an array that is more complex than you have allowed for, so your $image is not a filename but an array of filenames. If you output the files array you generated with a var_dump what do you get? |