Have you ever found a resolution to this problem? I have found myself in the same situation. My Curl upload works from terminal but does not from within laravel.
All troubleshooting seems to point to the file path not being correct or similar. It doesn't seem to see the file in question, no matter on file location or path used.
$authData = array( 'key' => $apiKey, 'signature' => $signature, 'nonce' => $nonce++ ); $authString = http_build_query($authData); $header = 'Authorization: Splynx-EA (' . $authString . ')';
$ch = curl_init();
$file_name_with_full_path = new CurlFile('CA_Customer_Sign_Up_Details_ENC.pdf','application/pdf', 'CA_Customer_Sign_Up_Details_ENC.pdf');
$post = array( 'file' => $file_name_with_full_path, );
curl_setopt($ch, CURLOPT_URL, $domainName . "/api/2.0/admin/customers/customer-documents/$doc_id--upload"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_HTTPHEADER, array( $header, "Content-Type: multipart/form-data", ));
$response = curl_exec($ch); curl_close($ch);
// var_dump($response); print_r($response);