Well I wish I could give you a direct answer.
From my simple-minded understanding, when you use an HTML form your have three methods to choose from: GET, POST, and PUT. I have been instructed to do a PUT. This requires some tweaking of the apache config file so that when the server recognizes this kind of form action, the server uses the stdin to PUT the file.
Using the samples for the PUT method found in the PHP documentation and sending the file via POST, the file gets copied to the server but there is nothing in the file...0 bytes.
Here is the form control script currently:
<?php
/* Flash LocalConnection Requests */
$browseLC = $_REQUEST['browseLC'];
$dataLC = $_REQUEST['dataLC'];
/* end of LC Requests */
/* store file name of upgrade file */
$filename = $_FILES['filename'];
$filename_name = $_FILES['filename']['name'];
echo('file = '.$filename_name);
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://stdin", "r");
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("file", "/tmp/PutUpgrade.stdout", "w"), // parent stdout
2 => array("file", "/tmp/PutUpgrade.stderr", "w") // parent stderr
);
$process = proc_open('/usr/local/client/cli/upgrade all', $descriptorspec, $pipes);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// 2 => readable handle connected to child stderr
/* Read the data 1 KB at a time
and write to the file */
while ($data = fread($putdata, 1024))
fwrite($pipes[0], $data);
fclose($pipes[0]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process);
}
/* Close the streams */
fclose($putdata);
/* send result back to Flash */
print "<HTML><BODY><script>window.top.upLoadEnd('$browseLC','$return_value','$filename_name','$dataLC')</script></HTML>";
?>