Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>file_get_contents</code> doesn't take the "r" parameter - see <a href="http://ie2.php.net/file_get_contents" rel="nofollow noreferrer">the PHP manual page</a>:</p> <pre><code>string file_get_contents ( string $filename [, int $flags...) </code></pre> <p>Valid <code>$flag</code> values are <code>FILE_USE_INCLUDE_PATH, FILE_TEXT, FILE_BINARY</code>.</p> <p>Try removing the "r" flag and trying again</p> <p><strong>Edit</strong> - question updated, "r" flag was being ignored so evidently not the root of the problem. </p> <p>It looks like there's a <a href="http://bugs.php.net/bug.php?id=33359" rel="nofollow noreferrer">reported bug in PHP</a> regarding <code>file_get_contents</code> returning an empty string for a HTTP POST. From the bug description:</p> <blockquote> <p><code>file_get_contents('php://input')</code> (and also <code>file, fopen+fread</code>) does not return POST data, when submited form with enctype="multipart/form-data".</p> <p>When submited the same form without enctype specified (so default "application/x-www-form-urlencoded" is used) all works OK.</p> </blockquote> <p>So it looks like a work-around is to change the specified form enctype away from <code>multipart/form-data</code>, which obviously isn't ideal for an image upload - from the <a href="http://www.w3.org/TR/html401/interact/forms.html" rel="nofollow noreferrer">W3 FORM specification</a>:</p> <blockquote> <p>The content type "application/x-www-form-urlencoded" is inefficient for sending large quantities of binary data or text containing non-ASCII characters. The content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data.</p> </blockquote> <p><strong>Further Edit</strong></p> <p>This bug seems to have been resolved in your PHP version. Have you checked to make sure that the buffer being read in doesn't start with a carriage-return / newline char? There's a problem somewhat similar to yours that was discussed <a href="http://www.sitepoint.com/forums/showthread.php?t=555002" rel="nofollow noreferrer">on Sitepoint</a>.</p> <p>Try running <a href="http://ie2.php.net/strlen" rel="nofollow noreferrer"><code>strlen</code></a> on the input and see what the length is.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload