Add debug response for file reading in readFiles method and improve error handling for file accessibility
This commit is contained in:
@@ -129,6 +129,20 @@ class SapFileController extends Controller
|
||||
return response()->json(['status' => 'ERROR', 'message' => 'File is empty'], 400);
|
||||
}
|
||||
|
||||
// Debug: return first 5 lines to check reading
|
||||
return response()->json([
|
||||
'status' => 'DEBUG_LINES',
|
||||
'file' => $fileName,
|
||||
'lines_sample' => array_slice($lines, 0, 5) // first 5 lines
|
||||
]);
|
||||
|
||||
if (!file_exists($filePath) || !is_readable($filePath)) {
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'message' => "File {$fileName} not found or not readable"
|
||||
], 500);
|
||||
}
|
||||
|
||||
$table = 'class_characteristics';
|
||||
$columns = Schema::getColumnListing($table); // returns lowercase column names
|
||||
|
||||
|
||||
Reference in New Issue
Block a user