PHP4.3.1 rouble with php://stdin (and also php://input)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edgecombe
Forum Newbie
Posts: 1
Joined: Wed Jul 16, 2003 8:57 pm
Location: Australia

PHP4.3.1 rouble with php://stdin (and also php://input)

Post by edgecombe »

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
Post Reply