Btw, this could be written better. You have `return $files[0];` twice here.