![]() |
CURL file upload - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: CURL file upload (/showthread.php?tid=91372) |
CURL file upload - 68thorby68 - 07-30-2024 Hi, I am trying to upload images via and API using CI CURL Request class. However, Codeigniter errors "CodeIgniter\HTTP\Exceptions\HTTPException 22 : The requested URL returned error: 400" referring to line 'file=>$myfile' PHP Code: $image = \Config\Services::image(); Above throw the HTTP errors!! However, using native curl with CI \CURLfile (at bottom) I do not get the error. PHP Code: $myfile = new \CURLFile($image_view_path); PHP Code: foreach($imagefiles['images'] as $img) { Above is successful. Any help would be appreciated. RE: CURL file upload - kenjis - 07-30-2024 Try PHP Code: $client->post('API ENDPOINT', [ See https://www.codeigniter.com/user_guide/libraries/curlrequest.html#multipart RE: CURL file upload - 68thorby68 - 07-31-2024 (07-30-2024, 07:55 PM)kenjis Wrote: Try Thank you so much. Works like a dream |