<?php
include_once ("../../../config.php");
include_once ("../path.php");

$modelFolder = $_GET["folder"];
$file = $json_instance_path . $modelFolder . '/'. $model_data_file;

$request_new_data = file_get_contents("php://input");
$new_json_data = json_decode($request_new_data);


if (!is_file($file))
{
    $json_data[] = $new_json_data;
    file_put_contents($file, json_encode($json_data));
}
else
{
    $data = file_get_contents($file);
    $json_data = json_decode($data);
    $json_data[] = $new_json_data;
    $result = json_encode($json_data);
    file_put_contents($file, $result);
}

exit;

