"Untitled", "note" => "ID: " . $id, "image" => $text ]; break; default: die("Invalid type"); } file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $_GET["member"] . ".json", json_encode($designs)); while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $_GET["member"] . ".json")) === "") { file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $_GET["member"] . ".json", json_encode($designs)); }