diff --git a/app/Http/Controllers/SapFileController.php b/app/Http/Controllers/SapFileController.php index 7a770ed52..a95f2800e 100644 --- a/app/Http/Controllers/SapFileController.php +++ b/app/Http/Controllers/SapFileController.php @@ -58,9 +58,14 @@ class SapFileController extends Controller } // Filter only .txt files - $files = array_filter($allFiles, function($file) use ($path) { - return $file !== '.' && $file !== '..' && is_file($path . $file) - && pathinfo($file, PATHINFO_EXTENSION) === 'txt'; + // $files = array_filter($allFiles, function($file) use ($path) { + // return $file !== '.' && $file !== '..' && is_file($path . $file) + // && pathinfo($file, PATHINFO_EXTENSION) === 'txt'; + // }); + + $files = array_filter($allFiles, function($item) use ($path) { + $fullPath = $path . '/' . $item; + return @is_file($fullPath) && pathinfo($item, PATHINFO_EXTENSION) === 'txt'; });