How to upload image using Discourse API

This still doesn’t appear to be working.

This is the error I get when trying to upload an image, in binary that is.

Unprocessable Entity - {\"failed\":\"FAILED\",\"message\":\"undefined method `tempfile' for an instance of String\"}