Php upload file yields error code 4. Why?

file-upload, forms, php

Solution

In this case, the problem was: I had multiple input elements with the attribute `name="image"`. When I changed to individual names the error disappeared.

Problem

The HTML: ``` <form action="formhandler.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" name="submit" value="Submit" /> </form> ``` and doing a `print_r($_FILES)` in formhandler.php after choosing a file and clicking submit yields: ``` [file] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) ``` And error code 4, according to the manual stands for "UPLOAD_ERR_NO_FILE - No file was uploaded" but I can't figure out why it wasn't uploaded.

Original source