y
Size: a a a
y
АБ
array:1 [▼
"image" => []
]
y
АБ
[]
y
y
АБ
АБ
AH
y
y
АБ
public static function UploadImage($originalName, $destinationPath)
{
try {
$host = env('IMAGE_API_HOST');
$endpoint = $host . "/image/upload";
$headers = [
'Content-Type' => 'multipart/form-data',
];
$client = new Client([
'headers' => $headers
]);
$response = $client->request('POST', $endpoint, [
'multipart' => [
[
'name' => 'image',
'contents' => fopen(public_path($destinationPath . $originalName), 'r'),
]
]
]);
$result = json_decode($response->getBody(), true);
dd($result);
} catch (\Exception $exception) {
Log::error($exception->getMessage());
$result = [];
} catch (GuzzleException $e) {
Log::error($e->getMessage());
$result = [];
}
return $result;
}
АБ
АБ
y
'name' => 'image',
y
'name' => 'image
[]',
y
y
y
АБ