update
This commit is contained in:
+5
-4
@@ -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
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user