buffer($contents); $info = array_merge($info, [ 'detectedMimeType' => $detectedMimeType, ]); // In our example, we respond with the uploadprogress information, as well as // the detected MIME type from the initial bytes uploaded (if we can detect it). header('HTTP/1.1 200 OK'); header('Content-Type: application/json'); echo json_encode($info);