2

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" } 

2 Answers 2

6

Files are available through $_FILES, not $_POST.

See the documentation for further information.

Sign up to request clarification or add additional context in comments.

Comments

4

In PHP when files are uploaded, they are accessible via the $_FILES superglobal, rather than in the $_POST superglobal. See POST Method Uploads

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.