文件上传代码,这段上传代码都不知道是我什么时候写的了,哈哈还是也拿出来吧,
<%
dim filename,filepath,filetype,obstream,fso,fod,sql'定义变量
filepath=request.Form("filename"'取得文件路径
if len(filepath)=0 or instr(filepath,"'"<>0 then'路径的合法性
response.Redirect("firstfile.asp?info=文件不合法"
else
filename=mid(filepath,instrrev(filepath,""+1)'取得文件名
filetype=mid(filename,instrrev(filename,"."+1)'取得文件类型
imagepath=server.mappath("image"
if instr(filetype,"jpg"<>0 or instr(filetype,"gif"<>0 or instr(filetype,"png"<>0 then'判断是否为我们要上传的文件
set fso=server.createobject("scripting.filesystemobject"
set fod=fso.getfolder(imagepath)
for each f in fod.files
f=mid(f,instrrev(f,""+1)
if f=filename then'判断文件是否存在
response.Redirect("firstfile.asp?info=文件己存在"
end if
next
set fso=nothing
set obstream=server.createobject("adodb.stream"
obstream.type=1
obstream.open
obstream.loadfromfile filepath
path="image"&filename
if obstream.size<500*1024 then
sql="select * from jimmy"
call opendb()
rs.open sql,cnn,1,3
rs.addnew
rs("image_path"=path
rs.update
call closedb()
obstream.savetofile server.mappath(path)'上传文件
response.Redirect("firstfile.asp?info=上传文件成功"
end if
obstream.close
set obstream=nothing
else
response.Redirect("firstfile.asp?info=文件不合法,必须是图片文件jpg,gif,png,"
end if
end if
%>
植物大战僵尸融合版v2.2版本在哪下载-v2.2版本下载地址分享
黑神话悟空像素版0.3版本在哪下载-0.3版本下载地址分享
黑神话悟空像素版0.4版本在哪下载-像素黑神话0.4版本下载地址分享
燕云十六声梨园和醉花阴怎么选-梨园和醉花阴选择推荐
Sensor Tower 数据显示《棕色尘埃 2》于台湾、香港登上营收排行第一名 每日活跃用户创新高
失落城堡2满级营地需要要多少金币-85级满级营地所需金币统计