CURLFile() is great with Content-Type: "multipart/form-data".
But, if you want to upload just a single file (e.g. for the Wordpress media API), then you have to do this WITHOUT using CURLFile(). i.e.
1. Set the relevant CURLOPT_HTTPHEADER values:
"Content-Type: image/jpeg"
"Content-Disposition: attachment; filename=myfile.jpg"
(where the content-type needs to be the appropriate mime-type for the uploaded file, and filename is the basename of the file).
2. Post the file contents directly within CURLOPT_POSTFIELDS:
file_get_contents($filename);