如何限制上传文件的类型?我很急,我在线马上结帖
在下面的文件里面加什么能做限制文件类型的上传,需要在upload.inc这个文件中改动什么吗?请帮助好吗
<!--#include FILE="upload.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath
set upload=new upload_5xSoft ''''建立上传对象
formPath=upload.form("filepath") ''''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''''列出所有上传了的文件
set file=upload.file(formName) ''''生成一个文件对象
if file.filesize<100 then
response.write "<font size=2>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.filesize>500*1000 then ''设置上传文件大小为500K
response.write "<font size=2>文件大小超过了限制 500K [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.FileSize>0 then ''''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath("updata\"&file.FileName) ''''保存文件
end if
set file=nothing
next
set upload=nothing
response.write "<font size=2>文件上传成功 [ <a href=# onclick=history.go(-1)>继续上传</a> ]</font>"
%>
</body>
</html>
<!--#include FILE="upload.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath
set upload=new upload_5xSoft ''''建立上传对象
formPath=upload.form("filepath") ''''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''''列出所有上传了的文件
set file=upload.file(formName) ''''生成一个文件对象
if file.filesize<100 then
response.write "<font size=2>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.filesize>500*1000 then ''设置上传文件大小为500K
response.write "<font size=2>文件大小超过了限制 500K [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.FileSize>0 then ''''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath("updata\"&file.FileName) ''''保存文件
end if
set file=nothing
next
set upload=nothing
response.write "<font size=2>文件上传成功 [ <a href=# onclick=history.go(-1)>继续上传</a> ]</font>"
%>
</body>
</html>
...全文
相关推荐
工具变量-省级-1999-2022-死亡率.xlsx
详细介绍及样例数据:https://blog.csdn.net/T0620514/article/details/144415002
全国、各省、地级市卫生机构数据面板1990-2019.xlsx
全国、各省、地级市卫生机构数据面板1990-2019.xlsx 数据来源:中国各省年鉴、城市统计年鉴 时间跨度:1999-2019年 范围:全国、各省、地级
SAP License USMM SLAW2 SAP审计
引言 企业每年都会收到SAP License审计邮件,邮件内容大致就是根据贵公司与SAP签定的合同XXX条款规定,贵公司所安装的SAP系统需要进行测定。 关键字: SAP License、 SAP USMM、 SLAW2、 SAP 账号、SAP 账号审计、 SAP License 审计、 SAP 审计报告、SAP 账号优化 SAP License审计邮件 企业每年都会收到SAP License审计邮件,邮件内容大致就是根据贵公司与SAP签定的合同XXX条款规定,贵公司所安...
华为AR6140E/S5735设备密码策略配置全攻略:从复杂度到锁定机制
本文详细介绍了华为AR6140E/S5735设备的密码策略配置方法,涵盖密码复杂度、时效性和防护性三大核心维度。通过具体的CLI命令示例,指导管理员如何设置密码长度、字符组合、有效期及登录失败锁定等安全机制,为企业网络提供全面的用户名密码防护策略。
电流互感器的使用分析
有关电流互感器使用的注意事项,回头再看,耳目一新。


