Reputation: 24019
I have the following page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
Click Browse and choose a file from your PC<br /><br />
<form method="POST" action="_URL_" enctype="multipart/form-data" name="IMGform">
<input type="file" name="image_upload"><br /><br />
<input class="button" type="Submit" value="Change Image">
<input type="hidden" name="add_image" value="true">
</form>
</body>
It simply produces nothing when I add a file to upload.
var_dump($_POST) only produces:
array(1) { ["add_image"]=> string(4) "true" }
Upvotes: 2
Views: 86
Reputation: 69977
In PHP when files are uploaded, they are accessible via the $_FILES
superglobal, rather than in the $_POST superglobal. See POST Method Uploads
Upvotes: 4
Reputation: 268462
Files are available through $_FILES
, not $_POST
.
See the documentation for further information.
Upvotes: 6