Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
fix(kuaishou): 🐛 CURLFile (#15)
Browse files Browse the repository at this point in the history
file 接口类型
  • Loading branch information
waset authored May 10, 2022
1 parent 6a10896 commit 42f2072
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Kuaishou/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ public function upload_multipart(string $endpoint, string $upload_token, string
{
$api_url = "http://${endpoint}/api/upload/multipart?upload_token=${upload_token}";

return $this->https_byte($api_url, $file);
$body = [
'file' => new \CURLFile($file),
];
$header = [
'Content-Type' => 'multipart/form-data',
];

return $this->https_post($api_url, $body, $header)->toArray();
}

/**
Expand Down Expand Up @@ -127,7 +134,7 @@ public function publish(string $access_token, string $upload_token, string $tit
$url = $this->https_url($api_url, $params);
$body = [
'caption' => $title,
'cover' => file_get_contents($cover_images),
'cover' => new \CURLFile($cover_images),
];
$res = $this->https_post($url, $body)->toArray();

Expand Down

0 comments on commit 42f2072

Please sign in to comment.