<p>All,</p>

<p>As part of an application I'm writing I need to have a HTTP PUT webservice which accepts incoming imagedata, which will by analyzed, validated, and added to a local file store.</p>

<p>My issue arises after the size validation as the </p>

<blockquote>
  <p><code>$_SERVER['CONTENT_LENGTH']</code></p>
</blockquote>

<p>has a > 0 value, and this value is identical to the test file size, so I can assume that all is going well up to this point <em>but</em> when I try to read the incoming stream data using </p>

<blockquote>
  <p><code>file_get_contents('php://stdin');</code></p>
</blockquote>

<p>I get an empty string. I've also tried using </p>

<blockquote>
  <p><code>file_get_contents('php://input');</code></p>
</blockquote>

<p>And this give me the same result of an empty string.</p>

<p>Any help, suggestions or direction will be appreciated.</p>

<p>NB: I'm using </p>

<ul>
<li>PHP 5.2.6</li>
<li>Apache 2.0</li>
</ul>

The
```
r
```
you've got as the second arg isn't right.
```
file_get_contents
```
doesn't use the
```
a/r/w/a+/r+/w+
```
arguments that
```
fopen
```
uses.  You probably want to remove it and just do:
```
```
file_get_contents('php://input');
```
```
See
http://us3.php.net/file_get_contents
.