";
print_r($_FILES);
echo "";
if (!empty($_FILES['files']['name'][0])) {
$fileCount = count($_FILES['files']['name']); // Get number of uploaded files
for ($i = 0; $i < $fileCount; $i++) {
if ($_FILES['files']['error'][$i] !== UPLOAD_ERR_OK) {
echo "Error uploading file: " . $_FILES['files']['name'][$i] . "
";
continue;
}
// Get file details
$fileName = $_FILES['files']['name'][$i];
$fileTmpPath = $_FILES['files']['tmp_name'][$i];
// Read file content (assuming JSON files)
if (pathinfo($fileName, PATHINFO_EXTENSION) == 'json') {
$jsonData = file_get_contents($fileTmpPath);
$data = json_decode($jsonData, true); // Convert JSON to an array
// Decode JSON into an object (not an array)
$data = json_decode($jsonData); // Removed "true" to get an object
if ($data === null) {
echo "Error decoding JSON in file: $fileName
";
continue;
}
// Display content of JSON file
echo "File: $fileName
";
echo "
" . print_r($data, true) . ""; echo $data->savedAt; } else { echo "Skipping non-JSON file: $fileName