Thanks a lot LornaJane! I've been hitting my head on the deck with this issue for a long time now.
About the multipart, as far as I know, this is the assumed way a PUT request should work.
PUT is not supposed to work with multipart/form-data, because you can send the raw contents of a file as the request body without encoding it. With curl, you'd specify the file with CURLOPT_INFILE and CURLOPT_INFILESIZE options. Or you can set CURLOPT_POSTFIELDS to a raw text/content and recieve it in php://input too.