The problem isn’t in your code – it’s in your request. You’re missing boundary in your multipart request. As it said in specification:
The Content-Type field for multipart entities requires one parameter,
“boundary”, which is used to specify the encapsulation boundary. The
encapsulation boundary is defined as a line consisting entirely of two
hyphen characters (“-“, decimal code 45) followed by the boundary
parameter value from the Content-Type header field.