Closed mytuny closed 1 year ago
Which version of PHP SDK are you using?
Since I used the default composer installation command, I got the version 3.0.0 (the latest version on Packagist).
@mytuny can you please share the code you are trying with?
<?php
use ImageKit\ImageKit;
require __DIR__ . '/../vendor/autoload.php';
$img = file_get_contents(__DIR__."/image.jpg");
$base64Img = base64_encode($img);
$imageKit = new ImageKit(
'public_xxxxxxx',
'private_xxxxxxx',
'https://ik.imagekit.io/xxxxxxx'
);
$uploadFile = $imageKit->uploadFile([
'file' => $base64Img,
'fileName' => 'image-test.jpg'
]);
echo ("Upload base64" . json_encode($uploadFile));
This is only one variation out of many I tried with.
Fixed in version 3.0.3
Hiya, I am currently using V3.0.3 with PHP 8.1.1 on windows 11. However, this error is still persisting. Followed the suggested solution here but it didn't work.
// Simplified version of what I am working with
$client = new ImageKit($publicKey, $privateKey, $endpoint);
$response = $client->uploadFile([
'file' => $base64Image,
'fileName' => $fileName,
'folder' => $folder,
]);
var_dump($response);
I'm trying to use the PHP SDK to upload a file but keep getting the same error despite using the basic examples ever (as explained in documentations for instance).
The error says: "Status code must be an integer value between 1xx and 5xx."
Which, as far as I can tell, is an issue related to the Guzzle package since I also found people in their community claiming to have the same error using Guzzle in their own contexts as well.
I believe a patch to the Guzzle package is required to solve the problem!
PS: I'm under Windows 10 / PHP 7.4
Thanks