上传文件不起作用

Dar*_*ney 2 html php

我有以下页面:

<!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>
Run Code Online (Sandbox Code Playgroud)

当我添加要上传的文件时,它什么都不生成.

var_dump($ _ POST)仅产生:

array(1) { ["add_image"]=> string(4) "true" } 
Run Code Online (Sandbox Code Playgroud)

Sam*_*son 6

文件可以通过$_FILES,而不是$_POST.

有关详细信息,请参阅文档.