up.php
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>img_upload</title>
</head>
<body>
<?php
var_dump($_FILES['file']);
$filename = './img/'.date('Y-m-d H:m:s') . '.jpg';
if ($_FILES['file']) {
move_uploaded_file($_FILES['file']['tmp_name'], $filename);
}
echo "<img src = '$filename'>"
?>
//enctypeは決まり文句
<form action="up2.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file" accept="image/*">
<input type="submit" value="ファイルをアップロードする">
</form>
</body>
</html>