I am working on a C# desktop app that uses the file digest API to upload website files.
It all works fine with the html files, but I get a 422 error (unprocessable entity) when uploading image files.
The way I’m trying to do it is as follows:
- I read the bytes from the image
- I convert them to a base64 string
- I place the base64 string in the content of the request
- The content is marked as type “application/octet-stream”
The logic that I use for the html files is similar, except I’m just reading the text and writing it to the request content (no base64 conversion).
Is there something wrong in the way I’m approaching this?