我真的不知道我该怎么办问题是当我尝试上传文件时$ _Files总是空的。
<form method="get" action="pic.php" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" name="submit">
</form>
<?php
$name=$_FILES["file"]["name"];
$tmp_name=$_FILES["file"]["tmp_name"];
echo "php is talking";
echo $name;
if(isset($name)&&!empty($name))
{
echo "OK";
$location="uploads/";
if(move_uploaded_file($name,$location.$name))
{
echo "the file has been Uploaded";
}
}
?>
答案 0 :(得分:1)
您必须将表单中的HTTP方法从GET更改为POST
<form method="POST" action="pic.php" enctype="multipart/form-data">