离婚孩子怎么判:如何设置 ASP无组件上传图片只上传jpg gif格式

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 02:53:08
<!--#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>50*1000 then ''设置上传文件大小为500K
response.write "<font size=2>文件大小超过了限制 50K [ <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>

怎么设置,只能上传JPG和gif格式
我QQ768780

在上传的时候检测文件类型!
如果是JPG/GIF 的话那就可以上传` 如果不是这个类型的话
那就提出警告`不允许上传!
不好意思! 我是PHPer ASP 的全忘拉! 呵呵!