daviddesberg / PHPoAuthLib

PHP 5.3+ oAuth 1/2 Client Library
Other
1.09k stars 454 forks source link

How to upload image to Etsy #541

Open CoolColdUK opened 6 years ago

CoolColdUK commented 6 years ago

I am using PHP 7 and laravel framework and CURL on phpoauthlib. The '@file_path' as suggested by etsy has been depreciated. I have tried to use the following $param['image']= new \CURLFile($image_path, mime_content_type($image_path), 'image.jpg');

I will get the error "rawurlencode() expects parameter 1 to be string, object given" in signature.php. I believe it tries to combine all parameter into single string.

If I am to use the following $param['image'] = base64_encode(file_get_contents($image_path));

I would get the error from Etsy saying "the request body is too large"

Is there any way I can upload or use curlfile at the moment? Will I be able to upload using steam instead?

Thanks in advance.

CoolColdUK commented 6 years ago

Hi again.

Got mine working using StreamContext following this method https://stackoverflow.com/a/4247082

Not elegant but did the job.