Be reminded that setting CURLOPT_POST to 0 or false will reset the request type to GET, or to whatever you set with CURLOPT_CUSTOMREQUEST.
So if you do set CURLOPT_PUT or CURLOPT_UPLOAD to true and then do CURLOPT_POST to 0 or false, you will not get any body in your request, even though the method you receive might be PUT (as set in CURLOPT_CUSTOMREQUEST), this could be quite confusing.