Update readFiles method in SapFileController to enhance error reporting and adjust file path

This commit is contained in:
dhanabalan
2025-09-23 10:46:24 +05:30
parent 1d998d6478
commit 8187aca5d4

View File

@@ -30,23 +30,23 @@ class SapFileController extends Controller
public function readFiles()
{
$path = "/srv/pds.iotsignin.com/sapftp/In/";
$path = "/srv/pds.iotsignin.com/www/out/";
$isDir = is_dir($path);
$isReadable = is_readable($path);
$isDir = is_dir($path);
$isReadable = is_readable($path);
if (!$isDir || !$isReadable) {
return response()->json([
'status' => 'error',
'message' => 'Folder not accessible',
'debug' => [
'path_checked' => $path,
'is_dir' => $isDir,
'is_readable' => $isReadable,
'php_user' => get_current_user(),
]
], 500);
}
if (!$isDir || !$isReadable) {
return response()->json([
'status' => 'error',
'message' => 'Folder not accessible',
'debug' => [
'path_checked' => $path,
'is_dir' => $isDir,
'is_readable' => $isReadable,
'php_user' => get_current_user(),
]
], 500);
}
// Scan folder
$allFiles = scandir($path);