Reputation: 1344
Sorry for the title, because I don't know how to name this problem. Please consider the following code
<?php
var_dump($_POST);
?>
<form name="submit_form" id="submit_form" method="POST" enctype="multipart/form-data">
<input type="hidden" name="update" value="y">
<input type="file" name="supplement_file" id="supplement_file" class="btn_general" />
<input type="submit" />
</form>
It's a PHP that simply do printing the submitting information. The first run, it displays empty, that makes sense. However, after I click submit, it still shows empty. But the request payload has been set already. I can see it via network tab in console.
------WebKitFormBoundaryO78Y428dBFHmIDbk
Content-Disposition: form-data; name="update"
y
------WebKitFormBoundaryO78Y428dBFHmIDbk
Content-Disposition: form-data; name="supplement_file"; filename="supplement2.wmv"
Content-Type: video/x-ms-wmv
------WebKitFormBoundaryO78Y428dBFHmIDbk--
What I expect is I can see the "update"="y"
after I submit this form.
I am using PHP 5.3 is that is the problem? And the content-type is strange. It's Content-Type:text/html
in this submit. Am I missing something?
UPDATE
The header information of the request
Connection:Keep-Alive
Content-Length:369
Content-Type:text/html
Date:Tue, 30 Dec 2014 10:01:22 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By:PHP/5.3.5
Upvotes: 0
Views: 771
Reputation: 3868
Yes I can see the "update"="y"
. it's working perfectly!!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<?php
if($_POST){
var_dump($_POST);
};
?>
<form name="submit_form" id="submit_form" method="POST" enctype="multipart/form-data">
<input type="hidden" name="update" value="y">
<input type="file" name="supplement_file" id="supplement_file" class="btn_general" />
<input type="submit" />
</form>
</body>
</html>
Upvotes: 0
Reputation: 198
Please open your php.ini file and search for these two lines:
; Maximum size of POST data that PHP will accept.
post_max_size = 8M
Increase the post_max_size to a higher value.
Upvotes: 3
Reputation: 207
Pls add action into form.and then try.
The form is required to have an action attribute in HTML4. If it's not set, the browser will likely use the same method as providing an empty string to it. You really should set action="" which is perfectly valid HTML4, follows standards, and achieves the same exact result.
<?php
var_dump($_POST);
?>
<form action="" name="submit_form" id="submit_form" method="POST" enctype="multipart/form-data" >
<input type="hidden" name="update" value="y">
<input type="file" name="supplement_file" id="supplement_file" class="btn_general" />
<input type="submit" />
</form>
Upvotes: 0