图片上传 PHP

<!DOCTYPE html>
<html>
<head>
	<title>test</title>
</head>
<body>
<form action="upload.php" enctype="multipart/form-data" method="post">
<input type="file" name="file">
<button>上传</button>
</form>
</body>
</html>
form默认是post提交,button默认是submit
upload.php
<?php
$file = $_FILES['file']['tmp_name'];//图片上传位置
$newfile = dirname(__FILE__).'/'.time().'.jpg';
move_uploaded_file($file,$newfile);
?>

相关推荐

评论 抢沙发

表情