Unable to access HTTP PUT data in webservice code
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.
My issue arises after the size validation as the
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 but when I try to read the incoming stream data using
I get an empty string. I've also tried using
And this give me the same result of an empty string.
Any help, suggestions or direction will be appreciated.
NB: I'm using
- PHP 5.2.6
- Apache 2.0
string file_get_contents ( string $filename [, int $flags...)
$flag values are
FILE_USE_INCLUDE_PATH, FILE_TEXT, FILE_BINARY.
Attempt getting rid of the "r" flag and also attempting once more
Edit - inquiry upgraded, "r" flag was being overlooked so seemingly not the origin of the trouble.
file_get_contents('php://input')(as well as additionally
file, fopen+fread) does not return POST information, when sent kind with enctype = "multipart/form - data".
When sent the very same kind without enctype defined (so default "application/x - www - kind - urlencoded" is made use of) all jobs OK.
The web content type "application/x - www - kind - urlencoded" mishandles for sending out huge amounts of binary information or message having non - ASCII personalities. The web content type "multipart/form - data" need to be made use of for sending kinds which contain documents, non - ASCII information, and also binary information.
This bug appears to have actually been settled in your PHP variation. Have you examined to see to it that the barrier reading in does not start with a carriage - return / newline char? There is a trouble rather comparable to your own that was reviewed .