1 先在www設資料夾upload
2 資料夾內放index.php C\Appserv\www\index.php\
3 //127.0.0.1上傳即可
<?
if($_FILES["upfile"]["name"] != "")
{
if(file_exists("upload/".$_FILES["upfile"]["name"]))
{
echo "<script>alert('檔案已經存在!');</script>";
}
else
{
move_uploaded_file($_FILES["upfile"]["tmp_name"],"upload/".$_FILES["upfile"]["name"]);
}
}
?>
<html>
<form action='' method='post' enctype='multipart/form-data'>
上傳檔案:<input type='file' name='upfile'>
<input type='submit' value='上傳'>
</html> |