我写的一个asp上传组件
网上流传的种种asp上传类真是太烦琐了,我自己写了一个上传类。这个上传类体积很小,只适用于单文件上传,返回结果是一个json,格式为:{"err":"出错原因","msg":"上传文件的地址"},例如:{"err":"\u6587\u4EF6\u592A\u5927\u4E86\2C\u4E0A\u4F20\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7200K","msg":""}
或者{"err":"","msg":"uploadfile/201013/7897896786.zip"}
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Option Explicit
Response.Buffer = True
response.charset = "gb2312"
Const uploadfolder="uploadpic"
Const allowExt="jpg,jpeg,gif,png,rar,doc,zip,xls,pdf,swf,avi,mp3,txt,htm,html"
Function BytestoStr(filestr)
dim skipflag : skipflag = 0
dim varlen,clow,i
dim content : content = ""
if not isnull(filestr) then
varlen = lenb(filestr)
for i=1 to varlen
if skipflag=0 then
clow = midb(filestr,i,1)
if ascb(clow) > 127 then
content = content & chr(ascw(midb(filestr,i+1,1) & clow))
skipflag = 1
else
content = content & chr(ascb(clow))
end if
else
skipflag = 0
end if
next
end if
BytestoStr = content
End Function
Function getFilepath(ext)
dim folderpath,fso,filename
folderpath=server.mappath(uploadfolder)
set fso=server.createobject("Scripting.FileSystemObject")
if Fso.FolderExists(folderpath)=false then fso.CreateFolder(folderpath)
folderpath=folderpath&"\"&replace(replace(date(),"/",""),"-","")
fileinfo=uploadfolder&date()
if Fso.FolderExists(folderpath)=false then fso.CreateFolder(folderpath)
filename=cstr(timer()*100)&"."&ext
getFilepath=folderpath&"\"&filename
fileinfo=fileinfo&"/"&filename
set Fso=nothing
End Function
Function CheckExt(fileinfo)
dim re
set re=new
相关文档:
摘自:http://zxlh168.blog.163.com/blog/static/7778614020098168638654/
<%
’FSO组件名称
dim FSObject
FSObject="Scripting.FileSystemObject"
’=========================================================
’◆是否支持组件
’=============================================== ......
asp中的rs.open于conn.execute的区别
rs.open sql,conn:如果sql是delete,update,insert则会返回一个关闭的记录集,在使用过程中不要来个rs.close在文件最后再写rs.close
中间可以来多个记录集rs1.open sql1,conn,最后一块关闭记录集:rs.close rs1.close
con ......
<div id="storyScroller" style="width:100%;height:140px;line-height:28px;overflow:hidden;">
<div id="storyScrollMid">
<ul id="storyScrollUl" style=" list-style-type:circle; list-style-position: outside; margin-left:18px; margin-right:0px">
<li>item01</l ......
<%
Function RemoveHTML( strText )
Dim TAGLIST
TAGLIST = ";!--;!DOCTYPE;A;ACRONYM;ADDRESS;APPLET;AREA;B;BASE;BASEFONT;" &_
&n ......