$charid = strtoupper(md5(uniqid(mt_rand(), true)));
    $hyphen = chr(45);
    // "-"
    $uuid = substr($charid, 0, 8) . substr($charid, 16, 4) . substr($charid, 20, 12);
    return $uuid;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $file = 'F:\\wampserver\\setup\\wamp\\www\\log.txt';
    $content = "进入服务程序\n";
    file_put_contents($file, $content, FILE_APPEND);
    if (!file_exists($destination_folder)) {
        mkdir($destination_folder);
    }
    $content = "创建文件\n";
    file_put_contents($file, $content, FILE_APPEND);
    $updateimag = new HeadImage();
    $updateback = new Backinform();
    $file = $_FILES["upfile"];
    $filename = $file["tmp_name"];
    $image_size = getimagesize($filename);
    $pinfo = pathinfo($file["name"]);
    $ftype = $pinfo['extension'];
    $destination = $destination_folder . create_guid() . "." . $ftype;
    $content = "移动文件\n";
    file_put_contents($file, $content, FILE_APPEND);
    if (!move_uploaded_file($filename, $destination)) {
        $content = "移动文件出错\n";
        file_put_contents($file, $content, FILE_APPEND);
        echo "移动文件出错";
        exit;
    }
    } catch (OssException $e) {
        WriteLog("上传原图失败信息" . $e->getMessage());
        $backinfo->kindbig = "NO";
    }
    Outputsmallimage($filename, 100, $destination_folder, $imagesmall);
    $object2 = "Ionic/Imagesmall/" . $imagesmall;
    $path = $destination_folder . $imagesmall;
    try {
        $ossClient->uploadFile($bucket, $object2, $path);
        $backinfo->kindsmall = "OK";
    } catch (OssException $e) {
        WriteLog("上传压缩图失败信息" . $e->getMessage());
        $backinfo->kindsmall = "NO";
    }
    unlink($path);
    if ($backinfo->kindsmall == "OK" && $backinfo->kindbig == "OK") {
        $insertimage = new HeadImage();
        $userid = test_input($_POST["userid"]);
        if ($insertimage->Update_image($userid, $kindbig) == "OK") {
            $backinfo->kind = "OK";
            $json = json_encode($backinfo);
            echo "{$json}";
            WriteLog("资源ID:" . $resourceid . "--成功上传截止:" . date('y-m-d h:i:s', time()) . "\n");
        } else {
            WriteLog("\n数据添加失败");
        }
    }
}
?>