Maison >développement back-end >tutoriel php >php-上传代码没错但是就是在路径里面不显示
php上传
<code> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <form action="doAction.php" method="post" enctype="multipart/form-data"> <!-- <input type="hidden" name="MAX_FILE_SIZE" value='176942' /> --> 请选择您要上传的文件:<input type="file" name="myFile"> <!-- <input type="file" name="myFile" accept="image/jpeg,image/gif,image/png"/><br /> --> <input type="submit" value="上传文件"> </form></code>
<code> <?php //$_FILES:文件上传变量print_r($_FILES);//获取数组里面的值 $filename=$_FILES['myFile']['name'];//上传文件的文件名$type=$_FILES['myFile']['type'];//上传文件的类型$size=$_FILES['myFile']['size'];//上传文件的大小$tmp_name=$_FILES['myFile']['tmp_name'];//上传文件的临时存放路径$error=$_FILES['myFile']['error'];//将服务器上的临时文件移动到指定目录下move_uploaded_file($tmp_name,"uploads/".$filename);//copy($tmp_name,"uploads/".$filename);?></code>