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

Hi, i'm trying to send a file over post API with multipart but after follow all the documentation and many post (this one included), i have the same issue. The requests doesn't contains any file.

Here are some of tryies i did.
Code:
$res = $this->client->request('POST', $url, [
            'headers' => [
                'Authorization' => 'Bearer ' . $_SESSION['token'],
            ],
            'multipart' => [
                'Content-Type' => 'multipart/form-data',
                'userfile'        => new CURLFile($realpath)
                //'contents' => curl_file_create($realpath, $type, $filename),
            ],
            'debug' => './curl_log.txt'
        ]);
Code:
$res = $this->client->request('POST', $url, [
            'headers' => [
                'Authorization' => 'Bearer ' . $_SESSION['token'],
            ],
            'multipart' => [
                'Content-Type' => 'multipart/form-data',
                'filename'     => $filename,
                'name'         => 'image',
                'type'         => $type,
                'contents'         => new CURLFile(FCPATH.$realpath, $type, $filename)
                //'contents' => curl_file_create($realpath, $type, $filename),
            ],
            'debug' => './curl_log.txt'
        ]);

Someone could help me? Confused
Reply


Messages In This Thread
RE: CURLRequest multipart File - nothing send - by Nehfer - 05-20-2020, 07:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB