<form action="UploadFile.php" method="post" enctype="multipart/form-data">
請輸入要上傳的檔案:<input type="file" name="myFileID" /><br/>
<input type="submit" value="上傳" />
</form>
UploadFile.php
$szUpLoad = "./uploadfiles/";
if( $_FILES["myFileID"]["error"] == UPLOAD_ERR_OK )
{
if( move_uploaded_file($_FILES["myFileID"]["tmp_name"],$szUpLoad.$_FILES["myFileID"]["name"]))
{
echo "成功";
}
else
{
echo "失敗\n";
echo $_FILES["myFileID"]["error"];
}
}
沒有留言:
張貼留言