, // then try uncommenting the following line: // $curl->setHeader('Content-Type', 'multipart/form-data'); $curl->post('https://httpbin.org/post', [ 'myfile' => $myfile, ]); if ($curl->error) { echo 'Error: ' . $curl->errorMessage . "\n"; } else { echo 'Success' . "\n"; }