This commit is contained in:
2023-04-12 11:49:35 +08:00
parent 2bd157debb
commit 9c0f5cdaf0
+5 -4
View File
@@ -244,12 +244,14 @@ function api_test()
function api_upload()
{
$url = "https://telegra.ph/upload";
$web = "https://demo.winxg.com";
$filePath = $_FILES["file"]["tmp_path"];
$url = "https://telegra.ph/upload";
$filePath = $_FILES["file"]["tmp_name"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'file' => new CURLFile($filePath)
));
@@ -257,7 +259,6 @@ function api_upload()
curl_close($ch);
$jsonArr = json_decode($response, true);
$src = $jsonArr[0]["src"] ?? "";
echo_json([
@@ -265,7 +266,7 @@ function api_upload()
"msg" => "",
"data" => [
"id" => $_POST["id"],
"src" => $src
"src" => $web . $src
]
]);