无法使用curl上传文件[关闭]

I was stuck with the same problem but it looked like the 'Content-Type: multipart/form-data' or adding @ did not resolve the issue.

References: how to upload file using curl with php

The only change here is we have to use the function CurlFile in place of @.

For multiple filesuse multiple tags:

$data['<Filetag1>'] = new CurlFile('<Filename1>');
$data['<Filetag2>'] = new CurlFile('<Filename2>');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);