I am trying to upload some files on server with PHP and HTML.
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<body>
<form action="upload3.php" method="post" enctype="multipart/form-data">
<p><input type="file" name="upload[]"/><br></p>
<p><input type="file" name="upload[]"/><br></p>
<p><input type="file" name="upload[]"/><br></p>
<input type='submit' name ='submit' value='Upload' />
</form>
</body>
</html>
PHP:
if(!empty($_FILES['submit']['name'][0])) {
$name_arr = $_Files['upload']['name'];
$tmp_arr = $_Files['upload']['tmp_name'];
$type_arr = $_Files['upload']['type'];
$error_arr = $_Files['upload']['error'];
echo count($tmp_arr);
for($i = 0; $i < count($tmp_arr); $i++) {
if(move_uploaded_file($tmp_arr[$i], "test_uploads/" . $name_arr[$i])) {
echo "Done";
} else {
echo "Nope";
}
}
} else
echo "What's going on?";
And I always get the "What's going on?" message or "the size of" e.g. $tmp_arr
"is 0".