<?php
header('Content-Type:text/html;charset=utf-8');
if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
$upfile = $_FILES['upfile'];
$name = $upfile['name'];
$type = $upfile['type'];
$size = $upfile['size'];
$tmp_name = $upfile['tmp_name'];
$upbool = move_uploaded_file($tmp_name, 'upimg/'.$name);
if ($upbool) {
echo "上传成功".'upimg/'.$name;
}else{
echo "上传失败!";
}
}
?>
<form action="" enctype="multipart/form-data" method="post" name="up">
上传文件:
<input type="file" name="upfile" id="">
<input type="submit" value="上传"><br/>
</form>