API 傳檔調整邏輯 20250604
This commit is contained in:
parent
fbc627b11a
commit
39872d5aac
@ -171,10 +171,11 @@ class ApiClient
|
|||||||
|
|
||||||
public function upload(string $endpoint, array $files = [], array $data = [])
|
public function upload(string $endpoint, array $files = [], array $data = [])
|
||||||
{
|
{
|
||||||
|
$this->setTimeout(300);
|
||||||
|
$this->setConnectTimeout(10);
|
||||||
return $this->requestWithCatch(function () use ($endpoint, $files, $data) {
|
return $this->requestWithCatch(function () use ($endpoint, $files, $data) {
|
||||||
$request = $this->timeout(300)
|
$request = $this->withDefaultHeaders();
|
||||||
->connectTimeout(300)
|
|
||||||
->withDefaultHeaders();
|
|
||||||
foreach ($files as $key => $filePath) {
|
foreach ($files as $key => $filePath) {
|
||||||
$filename = basename($filePath);
|
$filename = basename($filePath);
|
||||||
$request = $request->attach($key, fopen($filePath, 'r'), $filename);
|
$request = $request->attach($key, fopen($filePath, 'r'), $filename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user