Skip to content

Instantly share code, notes, and snippets.

@x3ro
Created February 26, 2012 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x3ro/1917473 to your computer and use it in GitHub Desktop.
Save x3ro/1917473 to your computer and use it in GitHub Desktop.
Weird PHP file-upload form behaviour
<?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