Using curl and php script to upload an image and text
Okay, so I found the issue. You'll need to use the CurlFile() class, instead of the '@' . $file_name example.
Docs: http://php.net/manual/en/class.curlfile.php
Instead of
$postfields['file_contents'] = '@' . $filename;
You'll want to do this
$postfields['file_contents'] = new CurlFile($filename);
You can look at the docs for specifying mime type and name on the other end in the constructor, but that's the basic gist of it.
Best of luck!