php://input returning empty string

谁都会走 提交于 2019-11-28 06:15:08

问题


The following code recently started returning empty strings. It works on other systems, so it doesn't appear to be a problem with the code itself. I literally eliminated all of the server-side code, and it still did the same thing. I also tried using file_get_contents to no avail, just kind of shooting in the dark.

$fileStream = fopen('php://input', 'rb');

$fileData = '';
while ($buffer = fread($fileStream, 4096)) {
    $fileData .= $buffer;
}

Server: Zend Server 5.1.0 (Apache 2.2.3)

Language: PHP 5.3.5

Front-End: Plupload (JavaScript plugin)


回答1:


php://input cannot be opened/read when receiving a multipart/form-data POST, maybe that's what changed client-sided? – Wrikken Mar 28 at 20:01

Thanks for your help!



来源:https://stackoverflow.com/questions/5463596/php-input-returning-empty-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!