Created
February 26, 2012 16:06
-
-
Save x3ro/1917473 to your computer and use it in GitHub Desktop.
Weird PHP file-upload form behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( isset($_POST['submitted']) ) { | |
var_dump($_POST); | |
var_dump($_FILES); | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>PHP File Upload</title> | |
</head> | |
<body> | |
<form action="" method="post" enctype="multipart/form-data"> | |
Some input field: <input type="text" value="Foo" name="data[first]" /> <br/> | |
Some other field: <input type="text" value="Bar" name="data[second]" /> <br/> | |
File (correct): <input type="file" name="correct" /> <br/> | |
File (broken): <input type="file" name="data[broken]" /> | |
<input type="submit" /> | |
<input type="hidden" name="submitted" value="1" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment