一个文件替换判断问题,急,在线等!

Hyulia 2004-04-14 03:13:59
<html>
<head>
<title>Upload File Result</title>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Hide stuff

function backToMain()
{
window.location.href = "first.php";
}

//End of script hiding comments -->
</SCRIPT>

</head>
<img src="../../images/commonimages/toplogo.gif" border=0><br><br>

<?php
$UploadAction=0;

$TimeLimit=60;
@set_time_limit($TimeLimit);

If(($UploadFile != "none")&&($UploadFile != ""))
{
$cgd=chdir("../../");
$UploadPath = "upload/".$id."/";
echo $uploadpath;
if(is_dir($UploadPath)) {
} else {
$dir=mkdir("upload/$id", 0700);
}
$FileName = $UploadPath.$UploadFile_name;
if($UploadFile_size <1024)
{
$FileSize = (string)$UploadFile_size . "KB";
}
else
if($UploadFile_size <(1024 * 1024))
{
$FileSize = number_format((double)($UploadFile_size / 1024), 1) . " KB";
}
else
{
$FileSize = number_format((double)($UploadFile_size/(1024*1024)),1)."MB";
}

if(!file_exists($FileName))
{
if(copy($UploadFile,$FileName))
{
echo "File Uploaded: $UploadFile_name <br>";
echo "Size: $FileSize";


}
else
{
echo "File(s) not uploaded.";
}
unlink($UploadFile);
}
else
{
echo "File already exist!"//这里怎样写成提示框,并根据判断决定是否替换原有文件???

}
}
else
{
echo "<center>Please check your file!</center>";
}

@set_time_limit(30);
?>
<BR>
<form method="post" name=form1 action="choosepage.php">
<INPUT TYPE=HIDDEN NAME=id VALUE="<? echo $id; ?>">
<table border=0>
<tr>
<td><INPUT TYPE=submit name="PageChoice" value="Upload Another File"></td>
<td><INPUT TYPE=BUTTON VALUE="Back To Main Page" onClick="javascript:backToMain()"></td>
</tr>
</table>
</form>
</BODY>
</HTML>
谢谢

...全文
25 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Hyulia 2004-04-15
To 52juanjuan(Fibona):

谢谢指点!
回复
52juanjuan 2004-04-14
else
{
echo "File already exist!"//这里怎样写成提示框,并根据判断决定是否替换原有文件???

}
}
改成下面的试试看,不过你得查查confirm的用法,俺不记得了
echo "<script>";
echo "confirm('是否替换原文件')";
ehco "</script>";

}
}
回复
ccterran 2004-04-14
要跳到其它页面才能执行是否替换
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告