<?php
include_once ('auth.php'); 
include_once ('functions.php');
if ($auth == 1) {
    $cli_user = $_SERVER["HTTP_CLIENT_ID"];
    if (isset($_POST["doc_fichero"])) {
        if (isset($_POST["doc_name"])) {
            if (isset($_POST["doc_size"])) {
                include_once ('servAddDoc_uploadDoc.php');
            }else {
                $data[] = array ( 
                    "status" => "NOT OK",
                    "message" => "error : doc_size is missing"
                );
            }
        }else {
            $data[] = array ( 
                "status" => "NOT OK",
                "message" => "error : doc_name is missing"
            );
        }                       
    }else {
        $data[] = array ( 
            "status" => "NOT OK",
            "message" => "error : doc_fichero is missing"
        );
    }
    header("Content-type: application/json; charset=utf-8");
    echo json_encode($data);
}elseif ($auth == 0) {
    $data = array();
    $data[] = array ( 
        "code" => "unauthorized_client",
        "message" => "Invalid authorization token"
    );
    header("Content-type: application/json; charset=utf-8");
    echo json_encode($data);
}
?>