PHP4.3.1 rouble with php://stdin (and also php://input)
Posted: Wed Jul 16, 2003 8:57 pm
Hi,
I'm trying to read an uploaded file from a "multipart/form-data" input on the asociated web page: The file content is therefore delivered on stdin.
The code snippet I'm using is:
if ($fp = fopen ("php://input", "r"))
{
print ("Fileopened?\n");
$buf = "";
while (! (feof ($fp)))
{
print ("reading..\n"); // debug feedback only
$buf .= fread ($fp, 4096);
print ("Buf: $buf"); // just as debug feedback
}
}
The file appears to open - but I get zero input using either php://stdin or php://input
(I've checked that file content is delivered on stdin by using a CGI script to check it. COntent is delivered OK.)
Any help would be much appreciated.
Thanks
rde
I'm trying to read an uploaded file from a "multipart/form-data" input on the asociated web page: The file content is therefore delivered on stdin.
The code snippet I'm using is:
if ($fp = fopen ("php://input", "r"))
{
print ("Fileopened?\n");
$buf = "";
while (! (feof ($fp)))
{
print ("reading..\n"); // debug feedback only
$buf .= fread ($fp, 4096);
print ("Buf: $buf"); // just as debug feedback
}
}
The file appears to open - but I get zero input using either php://stdin or php://input
(I've checked that file content is delivered on stdin by using a CGI script to check it. COntent is delivered OK.)
Any help would be much appreciated.
Thanks
rde