如何限制上传文件的类型?我很急,我在线马上结帖
在下面的文件里面加什么能做限制文件类型的上传,需要在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年 范围:全国、各省、地级
VL53L0X加盖玻片后精度暴跌?手把手教你完成串扰校准(CrossTalk Calibration)
本文详细解析了VL53L0X激光测距传感器加盖玻片后精度下降的原因,并提供了串扰校准(CrossTalk Calibration)的完整解决方案。通过分步指导和实用代码示例,帮助工程师恢复毫米级测距精度,适用于智能门锁、扫地机器人等应用场景。
Spring Boot整合AWS S3文件上传实战:从配置到权限管理全流程解析
本文详细解析了Spring Boot整合AWS S3文件上传的全流程,包括基础配置、核心上传功能实现、高级权限控制及安全最佳实践。通过实战案例展示如何高效处理文件上传、大文件分片及权限管理,帮助开发者构建健壮的文件管理系统。特别强调AWS S3的高可用性和安全性,适用于企业级应用开发。
ARCGIS绘制全国各省PM2.5浓度图操作步骤
ArcGIS新手小白一枚,经常需要帮助老师绘制一些简单的空间图,利用ArcGIS绘制全国各省的pm2.5浓度图,简单又方便,不记下来会忘记~


