2012-04-18 107 views
2

我有以下頁面:上傳文件不能正常工作

<!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> 

它只是產生什麼當我添加一個文件進行上傳。

的var_dump($ _ POST)只生產:

array(1) { ["add_image"]=> string(4) "true" } 

回答

4

在PHP上傳文件時,它們可以通過超全局的$_FILES訪問,而不是在$ _POST超全局中訪問。見POST Method Uploads