Well, you may be making progress!
Take a look at this post - I think you need to change the filename as Ross indicates:
In other words, I think at the beginning of the content it should be like:
Content-Disposition: form-data; name=“file”; filename=“example.txt”
Content-Type: text/plain