在点上传的的时候需要先判断文件格式是否属于允许的类型,JS实现代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<style type="text/css">
<!--
BODY{
BACKGROUND-COLOR: #f5feed;
font-size:9pt
}
.tx1 { height: 20px;font-size: 9pt; border: 1px solid;border-color: #000000; color: #0000FF}
-->
</style>
<SCRIPT language=javascript>
function check_file()
{
}
</SCRIPT>
</head>
<body leftmargin="0"topmargin="0">
<form action="#upfile.asp" method="post"name="form1" onSubmit="return check_file()"enctype="multipart/form-data">
</form>
<br>只允许上传这几种文件:rar、zip、jpg、gif、bmp、png、swf、doc、exe
</body>
</html>