Sorry, the name of the file type in my actual html code is "file".
I hope the explanation below can express my problem clearer.
I wrote a simple file upload to test (refer to listed), when I run it:
- the result goes to the division of "file is not set" in upload_file.php. And in phpinfo(), $_FILES doesn't exist at all.
- the result from "var_dump($_FILES);" is "array(0) { } "
upload_file.html:
<html>
<body>
<h2>Validate Uploaded File</h2>
<form method="post" enctype="multipart/form-data" action="./upload_file.php">
<table>
<tr><th><label for="uploaded_file">File:</label></th><td colspan="2"><input type="file" id="file" name="file" size="50" /></td></tr>
<tr><td />
<td><input type="submit" value="Upload" /></td>
<td />
</tr>
</table>
</form>
</body>
</html>
upload_file.php:
<?
echo "$file={". $file ."}\n";
echo "$FILES[file][name]={" . $FILES['file']['name'] ."}\n";
echo "$file_name={" . $file_name ."}\n";
if (!isset($file) || $file == "none")
{
echo "file is not set";
phpinfo();
}
else
{
echo "Wonderful";
phpinfo();
}
var_dump($_FILES);
?>