|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-05-18 15:06 UTC] requinix@php.net
-Summary: We use 'php://input', when we uploaded the binary
file from html form.
+Summary: php://input is available for multipart/form-data when
post_max_size error
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
[2017-05-18 15:06 UTC] requinix@php.net
[2017-05-22 12:44 UTC] aki dot sen dot 1209 at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 17:00:02 2025 UTC |
Description: ------------ So when we uploaded binary file from html form, PHP usually cannot use 'php://input' right? We usually use $_FILES, when we uploaded something binary. But I discovered loophole it. For example, you should set up '1024' with upload_max_filesize and '1024' with post_max_size in php.ini. Next you need to write 'ini_set("memory_limit", -1)' in source code which you should execute. So Let's upload something binary file to html form. Then, You would notice what '$_FILES' and '$_POST' is empty. But you can extract binary file from 'php://input'. Let's use 'file_get_contents' for binary , to extract binary file from raw 'php://input'. You would watch the notice of warning from PHP on display, But You can understand that the program was able to upload the binary file. Test script: --------------- <?php ini_set("memory_limit", -1); print_r($_FILES); print_r($_POST); print("<br >"); ob_start(); print(file_get_contents("php://input")); $get = ob_get_clean(); file_put_contents("/tmp/".time(), $get);