php将上传文件移动到指定位置move_uploaded_file(临时地址,目标地址)
php将上传文件移动到指定位置move_uploaded_file(临时地址,目标地址)函数:
move_uploaded_file(临时地址,目标地址)代码:
<body>
<?php
if(!empty($_POST)) {
if($_FILES['face']['error']==0){//上传正确
//文件上传
move_uploaded_file($_FILES['face']['tmp_name'],'./'.$_FILES['face']['name']);
}else{
echo '上传有误';
echo '错误码:'.$_FILES['face']['error'];
}
}
?>
<form method="post" action="" enctype='multipart/form-data'>
<input type="file" name="face">
<input type="submit" name="button" value="上传">
</form>
</body>小结:上传的同名的文件要给覆盖
页:
[1]