I'm not sure but perhaps you
curl version doesn't support setting the content type this way. Try to remove the
type= part from your code and let curl decide the content type:
$postData[$key] = "@" . realpath($fn);
You could also try setting the
CURLOPT_VERBOSE flag to true and see if you get a more descriptive error message.