Welcome Guest, Not a member yet? Register   Sign In
CURLRequest multipart File - nothing send
#9

Hi,

This is the way I was able to post a file to an API. I hope this helps.

PHP Code:
$curl = \Config\Services::curlrequest();
        $cfile = new \CURLFile($file['full_path'], $file['file_type'], $file['file_name']);
        $data $curl->request("POST"$targetURL, [
                            'auth' => [$user$password],
                            'headers' => [
                                'Content-type' => 'multipart/form-data'
                            ],
                            'multipart' => [
                                "operation" => $operation,
                                "id1" => $abc,
                                "id2" => $cde,
                                "filedata" => $cfile
                            
]
                        ]); 
Reply


Messages In This Thread
RE: CURLRequest multipart File - nothing send - by lrb00 - 03-28-2021, 10:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB