サンプル
fileUpLoad.html
<html>
<body>
<form action="UpLoadFile.php" method="post" enctype="multipart/form-data">
<input type="file" name="upfile" size="50" /><br />
<br />
<input type="submit" value="Upload" />
</form>
</body>
</html>
UpLoadFile.php
<html>
<body>
<p>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$updateFilePath = "../data/" . $_FILES["upfile"]["name"];
if (is_uploaded_file($_FILES["upfile"]["tmp_name"])) {
if (move_uploaded_file($_FILES["upfile"]["tmp_name"], $updateFilePath)) {
chmod($updateFilePath, 0644);
} else {
echo "<p align='center'><strong>cannot upload the file...</strong></p>";
}
} else {
echo "<p align='center'><strong>User didn't select the file...</strong></p>";
}
}
else
{
echo "<p align='center'><strong>It's not post...</strong></p>";
}
?>
</p>
</body>
</html>