1
0
forked from poc/pds

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