1
0
forked from poc/pds

Refactor readFiles method to dynamically set file path and improve file handling

This commit is contained in:
dhanabalan
2025-09-26 11:16:06 +05:30
parent 086910122e
commit c9b5a59bf2

View File

@@ -120,9 +120,11 @@ class SapFileController extends Controller
// 'files' => $data,
// ]);
$fileName = 'RMGLAS02-1725800-1.txt';
//$fileName = 'RMGLAS02-1725800-1.txt';
$fileName = array_values($files)[0];
$filePath = $path . '/' . $fileName;
$lines = file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (!$lines) {
return response()->json(['status' => 'ERROR', 'message' => 'File is empty'], 400);
}