Hi Lorna,

the main idea behind PUT is that you send some data directly to a resource name, something like

PUT https://mydomain.com/resources/myfile.ext

Handling this server side you wouldn’t expect form-encoded data but a (possibly binary) stream containing data for the named resource. As this data might be quite huge it should never be accessed using file_get_contents() as you might easily run in an OOM condition. I managed to transfer a couple of hundred megabytes like this:

$fin = fopen('php://input', 'rb');
$fount = fopen($mytmpfile, 'w');
while (!feof($fin)) {
$chunk = fread($fin, 80960);
fwrite($fout, $chunk);

Note this is only the skeleton, wihout any error handling. Note that at least on my end the chunksize read from input in one pass is never more than 8k, seems to be tied to the TCP window size.