curl_setopt(): filename cannot be empty - rewrite header: curl_setopt(): filename cannot be empty
P粉696605833
2023-08-29 10:33:38
<p>I tried running the test and got this error</p>
<pre class="brush:php;toolbar:false;">In Acceptance.php line 97:</pre>
<p>curl_setopt(): The file name cannot be empty</p>
<p>My Acceptence.php file</p>
<pre class="brush:php;toolbar:false;">$imgPath = codecept_output_dir() .'debug/fail.png';
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'chat_id' => $chatID,
'photo' => new \CURLFile(realpath($imgPath))
]);</pre>
I solved the problem, the fact was that the function "codecept_output_dir()" got the wrong path, thus causing the error. Thank you for your suggestions and answers)