I'm trying to upload a video using Laravel and GuzzleHttp to DailyMotion. Here's my code:
$file = "3.mp4"; $fields["file"] = fopen($file, 'rb'); $res = $client->post($upload_url, [ 'headers' => ['Content-Type' => 'multipart/form-data'], $fields ]); $data3 = $res->getBody(); $response_upload_video = json_decode($data3,true); echo "<br>Getting dm upload video response: "; print_r($response_upload_video); $upload_url is a dynamically generated URL passed by DailyMotion. Upon executing the code above, I'll always get this error:
Production.ERROR: GuzzleHttp\Exception\ClientException:
Client error: POST http://upload-02.sg1.dailymotion.com/upload?uuid=werewkrewrewrwer&seal=pppppppppppppppp`resulted in a 400 Bad Request response:
{"error":"invalid content range","seal":"yyyyyyyyyyyyyyyyyy"} in /home/vagrant/Code/svc-titus/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111
But I can upload video to the same upload URL using Postman, as displayed below: 