1. 求asp图片批量上传程序或源码
化境无组件上传
中的例子就是可以批量上传的
去看看?
QQ空间上传相册图片、网易相册上传样式
可需要组件了~
2. 谁给我个asp能批量上传图片的代码拜托了各位 谢谢
呵呵,演示地址: http://chinmo.ticp.net/pl/ 这个要比你说的那批量效果还好吧 显示部分代码: <html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="zh_cn" lang="zh_cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>多文件上传组件</title> </head> <body bgcolor="#ffffff" style="text-align:center;"> <!--影片中使用的 URL--> <!--影片中使用的文本--> <!-- saved from url=(0013)about:internet --> <script language="javascript"> function challs_flash_update(){ //Flash 初始化函数 var a={}; //定义变量为Object 类型 a.FormName = "Filedata"; //设置Form表单的文本域的Name属性 a.url="update.asp"; //设置服务器接收代码文件 a.parameter="bs=tyi&id=50"; //设置提交参数,以GET形式提交 a.typefile=["Images (*.gif,*.png,*.jpg)","*.gif;*.png;*.jpg"]; //设置可以上传文件 数组类型 //"Images (*.gif,*.png,*.jpg)"为用户选择要上载的文件时可以看到的描述字符串, //"*.gif;*.png;*.jpg"为文件扩展名列表,其中列出用户选择要上载的文件时可以看到的 Windows 文件格式,以分号相隔 a.UpSize=0.5; //可限制传输文件总容量,0或负数为不限制,单位MB a.fileNum=6; //可限制待传文件的数量,0或负数为不限制 a.size=0.2; //上传单个文件限制大小,单位MB,可以填写小数类型 a.FormID=['select','select2']; //设置每次上传时将注册了ID的表单数据以POST形式发送到服务器 //需要设置的FORM表单中checkbox,text,textarea,radio,select项目的ID值 //参数为数组类型,注意使用此参数必须有 challs_flash_FormData() 函数支持 a.CompleteClose=true; //设置为true时,上传完成的条目,将也可以取消删除条目,这样参数 UpSize 将失效, 默认为false return a ; //返回Object } function challs_flash_onComplete(a){ //每次上传完成调用的函数,并传入一个Object类型变量,包括刚上传文件的大小,名称,上传所用时间,文件类型 var name=a.fileName; //获取上传文件名 var size=a.fileSize; //获取上传文件大小,单位字节 var time=a.updateTime; //获取上传所用时间 单位毫秒 var type=a.fileType; //获取文件类型,在 Windows 上,此属性是文件扩展名。 在 Macintosh 上,此属性是由四个字符组成的文件类型 document.getElementById('show').innerHTML+='<a href="'+name+'" target="_blank">'+name+' --- '+size+'字节 ----文件类型:'+type+'--- 用时 '+(time/1000)+'秒</a><br/><br/>';//' } function challs_flash_onCompleteData(a){ //获取服务器反馈信息事件 document.getElementById('show').innerHTML+='<font color="#ff0000">服务器端反馈信息:</font><br />'+a+'<br />'; } function challs_flash_onStart(a){ //开始一个新的文件上传时事件,并传入一个Object类型变量,包括刚上传文件的大小,名称,类型 var name=a.fileName; //获取上传文件名 var size=a.fileSize; //获取上传文件大小,单位字节 var type=a.fileType; //获取文件类型,在 Windows 上,此属性是文件扩展名。 在 Macintosh 上,此属性是由四个字符组成的文件类型 document.getElementById('show').innerHTML+=name+'开始上传!<br />'; } function challs_flash_onCompleteAll(){ //上传文件列表全部上传完毕事件 document.getElementById('show').innerHTML+='<font color="#ff0000">所有文件上传完毕!</font><br />'; //window.location.href=' http://www.access2008.cn/update'; //传输完成后,跳转页面 } function challs_flash_FormData(a){// 使用FormID参数时必要函数 try{ return document.getElementById(a).value; }catch(e){ return ''; } } </script> 这个选择框的数据将以POST形式和图片一起传送到服务器 <select id="select"> <option value="老虎">老虎</option> <option value="兔子">兔子</option> <option value="骏马">骏马</option> </select> <select id="select2"> <option value="石头">石头</option> <option value="剪子">剪子</option> <option value="布">布</option> </select> <br> <br> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="408" height="323" id="update_" align="middle"> <param name="allowFullScreen" value="false" /> <param name="allowScriptAccess" value="always" /> <param name="movie" value="update_.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed src="update_.swf" quality="high" bgcolor="#ffffff" width="408" height="323" name="update_" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" /> </object> <div id="show" style="margin-top:20px; width:500px; text-align:left;"></div> </body> </html> 上传部分代码: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% dim oUpFileStream call wenjiansc("\") '这里可以设置存放目录 sub wenjiansc(a) dim upload,file,formName,iCount,fileurl if left(a,1)="\" then a=right(a,len(a)-1) if right(a,1)<>"\" then a=a&"\" if a="\" then a="" set upload=new upload_5xSoft ''建立上传对象 for each formName in upload.file ''列出所有上传了的文件 set file=upload.file(formName) ''生成一个文件对象 filekzmzz=filekzm(file.FileName) if filekzmzz="gif" or filekzmzz="jpg" or filekzmzz="jpeg" or filekzmzz="bmp" or filekzmzz="png" or filekzmzz="mp3" then if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据 file.SaveAs Server.mappath(a&file.FileName) ''保存文件 set file=nothing end if end if next Response.Write("上传成功!你选择的是<font color='#ff0000'>"&upload.Form("select")&"</font>--<font color='#0000ff'>"&upload.Form("select2")&"</font>") set upload=nothing end sub Function filekzm(textS) dim p,ii,c c=len(texts) for ii=1 to 10 p=mid(texts,c-ii,1) if p="." then filekzm=lcase(mid(texts,c-ii+1,ii)) exit for end if next end function Class upload_5xSoft dim Form,File,Version Private Sub Class_Initialize dim RequestBinDate,sStart,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo dim iFileSize,sFilePath,sFileType,sFormvalue,sFileName dim iFindStart,iFindEnd dim iFormStart,iFormEnd,sFormName Version="无组件上传类" set Form=Server.CreateObject("Scripting.Dictionary") set File=Server.CreateObject("Scripting.Dictionary") if Request.TotalBytes<1 then Exit Sub set tStream = Server.CreateObject("adodb.stream") set oUpFileStream = Server.CreateObject("adodb.stream") oUpFileStream.Type = 1 oUpFileStream.Mode =3 oUpFileStream.Open oUpFileStream.Write Request.BinaryRead(Request.TotalBytes) oUpFileStream.Position=0 RequestBinDate =oUpFileStream.Read iFormStart = 1 iFormEnd = LenB(RequestBinDate) bCrLf = chrB(13) & chrB(10) sStart = MidB(RequestBinDate,1, InStrB(iFormStart,RequestBinDate,bCrLf)-1) iStart = LenB (sStart) iFormStart=iFormStart+iStart+1 while (iFormStart + 10) < iFormEnd iInfoEnd = InStrB(iFormStart,RequestBinDate,bCrLf & bCrLf)+3 tStream.Type = 1 tStream.Mode =3 tStream.Open oUpFileStream.Position = iFormStart oUpFileStream.CopyTo tStream,iInfoEnd-iFormStart tStream.Position = 0 tStream.Type = 2 tStream.Charset ="utf-8" sInfo = tStream.ReadText '取得表单项目名称 iFormStart = InStrB(iInfoEnd,RequestBinDate,sStart) iFindStart = InStr(22,sInfo,"name=""",1)+6 iFindEnd = InStr(iFindStart,sInfo,"""",1) sFormName = Mid (sinfo,iFindStart,iFindEnd-iFindStart) '如果是文件 if InStr (45,sInfo,"filename=""",1) > 0 then set oFileInfo=new FileInfo '取得文件名 iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10 iFindEnd = InStr(iFindStart,sInfo,"""",1) sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart) oFileInfo.FileName=getFileName(sFileName) oFileInfo.FilePath=getFilePath(sFileName) '取得文件类型 iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14 iFindEnd = InStr(iFindStart,sInfo,vbCr) oFileInfo.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart) oFileInfo.FileStart =iInfoEnd oFileInfo.FileSize = iFormStart -iInfoEnd -3 oFileInfo.FormName=sFormName file.add sFormName,oFileInfo else '如果是表单项目 tStream.Close tStream.Type =1 tStream.Mode =3 tStream.Open oUpFileStream.Position = iInfoEnd oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-3 tStream.Position = 0 tStream.Type = 2 tStream.Charset ="utf-8" sFormvalue = tStream.ReadText form.Add sFormName,sFormvalue end if tStream.Close iFormStart=iFormStart+iStart+1 wend RequestBinDate="" set tStream =nothing End Sub Private Sub Class_Terminate if not Request.TotalBytes<1 then form.RemoveAll file.RemoveAll set form=nothing set file=nothing oUpFileStream.Close set oUpFileStream =nothing end if End Sub Private function GetFilePath(FullPath) If FullPath <> "" Then GetFilePath = left(FullPath,InStrRev(FullPath, "\")) Else GetFilePath = "" End If End function Private function GetFileName(FullPath) If FullPath <> "" Then GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1) Else GetFileName = "" End If End function End Class Class FileInfo dim FormName,FileName,FilePath,FileSize,FileType,FileStart Private Sub Class_Initialize FileName = "" FilePath = "" FileSize = 0 FileStart= 0 FormName = "" FileType = "" End Sub Public function SaveAs(FullPath) dim oFileStream,ErrorChar,i SaveAs=1 if trim(fullpath)="" or right(fullpath,1)="/" then exit function set oFileStream=CreateObject("Adodb.Stream") oFileStream.Type=1 oFileStream.Mode=3 oFileStream.Open oUpFileStream.position=FileStart oUpFileStream.to oFileStream,FileSize oFileStream.SaveToFile FullPath,2 oFileStream.Close set oFileStream=nothing SaveAs=0 end function End Class Function filekzm(textS) dim p,ii,c c=len(texts) for ii=1 to 10 p=mid(texts,c-ii,1) if p="." then filekzm=lcase(mid(texts,c-ii+1,ii)) exit for end if next end function function ObjTest(strObj) on error resume next ObjTest=false set TestObj=server.CreateObject (strObj) If -2147221005 <> Err then ObjTest = True end if set TestObj=nothing end function %>
3. 求ASP多张图片上传的详细代码
<%Server.ScriptTimeOut=5000%>
<!--#include file="conn.asp"-->
<!--#include file="upload_5xsoft.inc"-->
<html>
<head>
<title>文件上传</title>
<link rel="stylesheet" href="images/style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,exeec,wjm,lm
set upload=new upload_5xsoft
formPath="pictures/"
wjm=upload.form("file")
wjdx=0
for each formName in upload.objFile
if upload.form("zclj")="" then
set file=upload.file(formName)
wjdx = file.filesize
kzm = right(file.filename,4)
else
kzm = right(wjm,4)
end if
if lcase(kzm)<>".gif" and lcase(kzm)<>".bmp" and lcase(kzm)<>".jpg" then response.Redirect("add_pic.asp")
if upload.form("zclj")<>"" or wjdx<819200 then
set rs=server.CreateObject("adodb.recordset")
name=formPath + replace(cstr(date()),"-","") + replace(cstr(time()),":","") + kzm
'定义记录集,把用户输入的数据插入到数据表中
sql="select * from message"
rs.open sql,conn,1,3
rs.addnew
rs("add_date")=right(cstr(date()),len(cstr(date()))-2)
rs("add_time")=time
if upload.form("zclj")="" then
rs("zp")=name
dx=cstr(file.filesize/1024)
if len(dx) >6 then dx=left(dx,6)
rs("wjdx") = dx +"K"
else
rs("zp")=wjm
rs("wjdx") = "0K"
end if
small_class_id=upload.form("small_class_id")
rs("small_class_id")=small_class_id
rs("big_class_id")=small_class_id
zt=upload.form("zt")
rs("zt")=zt
title=upload.form("title")
rs("title")=title
if wjdx>0 and wjdx<819200 and upload.form("zclj")="" then
file.SaveAs Server.mappath(name)
end if
iCount=iCount+1
rs.update
rs.close
cg="1"
end if
set file=nothing
next
set upload=nothing '删除此对象
sub HtmEnd(Msg)
set upload=nothing
response.end
end sub
if cg="1" then response.redirect "add_pic.asp"
%>
不能上传大于800K的文件(0.8M)!
</body>
</html>
=========
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="images/style.css" -->
<body>
<form name="dd" method="post" action="scfile.asp" enctype="multipart/form-data" >
<input type="hidden" name="act" value="upload">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>图片主题:<input name="zt" type="text" class="inputtext" size="30" maxlength="100"></td></tr>
<tr><td>标题:<input name="title" type="text" class="inputtext" id="title" size="65"></td></tr>
<tr>
<td colspan="2" align="left" id="upid2">
<label>
<select name="small_class_id" id="small_class_id">
<option value="52">第1-8类商品</option>
<option value="44">第9-14类商品 </option>
<option value="79">第15-19类商品</option>
<option value="124">第20-22类商品</option>
</select>
</label> </td>
</tr>
<tr height="25">
<td colspan="2" align="left" id="upid"><input type="file" name="file1"></td>
</tr>
<tr height="25">
<td colspan="2" align="left" id="upid"></td>
</tr>
<tr height="25">
<td colspan="2" align="center">
<input type="submit" value=" 发 送 " name="cmdOk" class="inputbox" style="font-family: 宋体; font-size: 9pt;">
<input type="reset" name="Submit2" value=" 重 设 " class="inputbox" style="font-family: 宋体; font-size: 9pt;"> </td>
</tr>
</table>
</form>
</body>
</html>
4. 我弄了个asp空间下了一个asp整站源码可是东西太多.用FTP上传工具把这些一起上传具体怎么操作
看空间是否支持在线解压,如果支持就
先用FLASHFXP把整包传到主目录下。
然后在空间商网站上面控制面板里面进行
自解压即可。如果不支持,只能把所有
文件全选用FLASHFXP上传。
5. 跪求图片批量上传的asp程序源代码
艾恩无组件上传
搜索一下这个作者的网站,写了很多比较好的作品。我发的这个估计是他比较早的作品了
http://down.chinaz.com/soft/24607.htm
或者你可以把图片地址读取出来,存入数组,再用循环一个个的上传。。
6. ASP怎样实现批量上传图片,插入到ACCESS数据库,谁有代码案例,注:无组件 网页 图片 html
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% function GetFilePath(FullPath,str) If FullPath <> "" Then GetFilePath = left(FullPath,InStrRev(FullPath, str)) Else GetFilePath = "" End If End function %> <% class clsUp '文件上传类 '------------------------ Dim Form,File Dim AllowExt_ '允许上传类型(白名单) Dim NoAllowExt_ '不允许上传类型(黑名单) Private oUpFileStream '上传的数据流 Private isErr_ '错误的代码,0或true表示无错 Private ErrMessage_ '错误的字符串信息 Private isGetData_ '指示是否已执行过GETDATA过程 '------------------------------------------------------------------ '类的属性 Public Property Get Version Version="上传类声明" End Property Public Property Get isErr '错误的代码,0或true表示无错 isErr=isErr_ End Property Public Property Get ErrMessage '错误的字符串信息 ErrMessage=ErrMessage_ End Property Public Property Get AllowExt '允许上传类型(白名单) AllowExt=AllowExt_ End Property Public Property Let AllowExt(Value) '允许上传类型(白名单) AllowExt_=LCase(Value) End Property Public Property Get NoAllowExt '不允许上传类型(黑名单) NoAllowExt=NoAllowExt_ End Property Public Property Let NoAllowExt(Value) '不允许上传类型(黑名单) NoAllowExt_=LCase(Value) End Property '---------------------------------------------------------------- '类实现代码 '初始化类 Private Sub Class_Initialize isErr_ = 0 NoAllowExt="" '黑名单,可以在这里预设不可上传的文件类型,以文件的后缀名来判断,不分大小写,每个每缀名用;号分开,如果黑名单为空,则判断白名单 NoAllowExt=LCase(NoAllowExt) AllowExt="" '白名单,可以在这里预设可上传的文件类型,以文件的后缀名来判断,不分大小写,每个后缀名用;号分开 AllowExt=LCase(AllowExt) isGetData_=false End Sub '类结束 Private Sub Class_Terminate on error Resume Next '清除变量及对像 Form.RemoveAll Set Form = Nothing File.RemoveAll Set File = Nothing oUpFileStream.Close Set oUpFileStream = Nothing End Sub '分析上传的数据 Public Sub GetData (MaxSize) '定义变量 on error Resume Next if isGetData_=false then Dim RequestBinDate,sSpace,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo Dim sFormValue,sFileName Dim iFindStart,iFindEnd Dim iFormStart,iFormEnd,sFormName '代码开始 If Request.TotalBytes < 1 Then '如果没有数据上传 isErr_ = 1 ErrMessage_="没有数据上传" Exit Sub End If If MaxSize > 0 Then '如果限制大小 If Request.TotalBytes > MaxSize Then isErr_ = 2 '如果上传的数据超出限制大小 ErrMessage_="上传的数据超出限制大小" Exit Sub End If End If Set Form = Server.CreateObject ("Scripting.Dictionary") Form.CompareMode = 1 Set File = Server.CreateObject ("Scripting.Dictionary") File.CompareMode = 1 Set tStream = Server.CreateObject ("ADODB.Stream") Set oUpFileStream = Server.CreateObject ("ADODB.Stream") oUpFileStream.Type = 1 oUpFileStream.Mode = 3 oUpFileStream.Open oUpFileStream.Write Request.BinaryRead (Request.TotalBytes) oUpFileStream.Position = 0 RequestBinDate = oUpFileStream.Read iFormEnd = oUpFileStream.Size bCrLf = ChrB (13) & ChrB (10) '取得每个项目之间的分隔符 sSpace = MidB (RequestBinDate,1, InStrB (1,RequestBinDate,bCrLf)-1) iStart = LenB(sSpace) iFormStart = iStart+2 '分解项目 Do iInfoEnd = InStrB (iFormStart,RequestBinDate,bCrLf & bCrLf)+3 tStream.Type = 1 tStream.Mode = 3 tStream.Open oUpFileStream.Position = iFormStart oUpFileStream.CopyTo tStream,iInfoEnd-iFormStart tStream.Position = 0 tStream.Type = 2 tStream.CharSet = "gb2312" sInfo = tStream.ReadText '取得表单项目名称 iFormStart = InStrB (iInfoEnd,RequestBinDate,sSpace)-1 iFindStart = InStr (22,sInfo,"name=""",1)+6 iFindEnd = InStr (iFindStart,sInfo,"""",1) sFormName = Mid (sinfo,iFindStart,iFindEnd-iFindStart) '如果是文件 If InStr (45,sInfo,"filename=""",1) > 0 Then Set oFileInfo = new clsFileInfo '取得文件属性 iFindStart = InStr (iFindEnd,sInfo,"filename=""",1)+10 iFindEnd = InStr (iFindStart,sInfo,""""&vbCrLf,1) sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart) oFileInfo.FileName = GetFileName(sFileName) oFileInfo.FilePath = GetFilePath(sFileName) oFileInfo.FileExt = GetFileExt(sFileName) iFindStart = InStr (iFindEnd,sInfo,"Content-Type: ",1)+14 iFindEnd = InStr (iFindStart,sInfo,vbCr) oFileInfo.FileMIME = Mid(sinfo,iFindStart,iFindEnd-iFindStart) oFileInfo.FileStart = iInfoEnd oFileInfo.FileSize = iFormStart -iInfoEnd -2 oFileInfo.FormName = sFormName file.add sFormName,oFileInfo else '如果是表单项目 tStream.Close tStream.Type = 1 tStream.Mode = 3 tStream.Open oUpFileStream.Position = iInfoEnd oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-2 tStream.Position = 0 tStream.Type = 2 tStream.CharSet = "gb2312" sFormValue = tStream.ReadText If Form.Exists (sFormName) Then Form (sFormName) = Form (sFormName) & ", " & sFormValue else Form.Add sFormName,sFormValue End If End If tStream.Close iFormStart = iFormStart+iStart+2 '如果到文件尾了就退出 Loop Until (iFormStart+2) >= iFormEnd RequestBinDate = "" Set tStream = Nothing isGetData_=true end if End Sub '保存到文件,自动覆盖已存在的同名文件 Public Function SaveToFile(Item,Path) SaveToFile=SaveToFileEx(Item,Path,True) End Function '保存到文件,自动设置文件名 Public Function AutoSave(Item,Path) AutoSave=SaveToFileEx(Item,Path,false) End Function '保存到文件,OVER为真时,自动覆盖已存在的同名文件,否则自动把文件改名保存 Private Function SaveToFileEx(Item,Path,Over) On Error Resume Next Dim oFileStream Dim tmpPath Dim nohack '防黑缓冲 isErr=0 Set oFileStream = CreateObject ("ADODB.Stream") oFileStream.Type = 1 oFileStream.Mode = 3 oFileStream.Open oUpFileStream.Position = File(Item).FileStart oUpFileStream.CopyTo oFileStream,File(Item).FileSize nohack=split(path,".") '重要修改,防止黑客二进制"01"断名!!! tmpPath=nohack(0)&"."&nohack(ubound(nohack)) '重要修改,防止黑客二进制"01"断名!!! if Over then if isAllowExt(GetFileExt(tmpPath)) then oFileStream.SaveToFile tmpPath,2 Else isErr_=3 ErrMessage_="该后缀名的文件不允许上传!" End if Else Path=GetFilePath(Path) if isAllowExt(File(Item).FileExt) then do Err.Clear() nohack=split(Path&GetNewFileName()&"."&File(Item).FileExt,".") '重要修改,防止黑客二进制"01"断名!!! tmpPath=nohack(0)&"."&nohack(ubound(nohack)) '重要修改,防止黑客二进制"01"断名!!! oFileStream.SaveToFile tmpPath loop Until Err.number<1 oFileStream.SaveToFile Path Else isErr_=3 ErrMessage_="该后缀名的文件不允许上传!" End if End if oFileStream.Close Set oFileStream = Nothing if isErr_=3 then SaveToFileEx="" else SaveToFileEx=GetFileName(tmpPath) End Function '取得文件数据 Public Function FileData(Item) isErr_=0 if isAllowExt(File(Item).FileExt) then oUpFileStream.Position = File(Item).FileStart FileData = oUpFileStream.Read (File(Item).FileSize) Else isErr_=3 ErrMessage_="该后缀名的文件不允许上传!" FileData="" End if End Function '取得文件路径 Public function GetFilePath(FullPath) If FullPath <> "" Then GetFilePath = Left(FullPath,InStrRev(FullPath, "\")) Else GetFilePath = "" End If End function '取得文件名 Public Function GetFileName(FullPath) If FullPath <> "" Then GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1) Else GetFileName = "" End If End function '取得文件的后缀名 Public Function GetFileExt(FullPath) If FullPath <> "" Then GetFileExt = LCase(Mid(FullPath,InStrRev(FullPath, ".")+1)) Else GetFileExt = "" End If End function '取得一个不重复的序号 Public Function GetNewFileName() dim ranNum dim dtNow dtNow=Now() ranNum=int(90000*rnd)+10000 GetNewFileName=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum End Function Public Function isAllowExt(Ext) if NoAllowExt="" then isAllowExt=cbool(InStr(1,";"&AllowExt&";",LCase(";"&Ext&";"))) else isAllowExt=not CBool(InStr(1,";"&NoAllowExt&";",LCase(";"&Ext&";"))) end if End Function End Class PS:下面还有一部分代码!最后需要整合一起!
7. 重金悬赏ASP同时上传不同文件到不同文件夹的源码!
看你是用什么上传方式。
比如在“化镜ASP无组件上传V2.0”的类文件中,有一个保存文件的函数:
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=true
if trim(fullpath)="" or FileStart=0 or FileName="" or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
Data_5xsoft.position=FileStart
Data_5xsoft.to dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=false
end function
在调用SaveAs函数时,对不同的文件指明不同的路径就可以了。
8. (ASP源码)求一个可用Excel数据批量导入到Access的ASP程序
完全正确的过程,我先做完实验才回答的:
第一步:建立好你的access数据表对应excel的各个字段。
第二步:asp与excel建立联系,从excel中读取数据,具体代码如下:
<%
'创建数据库连接对象
set excelconn=server.createobject("adodb.connection")
'获取你的excel数据表路径,将excel1替换为你的excel文件名
strAddr1 = Server.MapPath("excel1.xls")
'打开excel数据源
excelconn.open "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" & strAddr1
'建立excel记录集
set excelrs=server.createobject("adodb.recordset")
'你的sql语句,sheet1替换为你的表名
sql="select * from [Sheet1$]"
'执行sql语句
excelrs.open sql,excelconn,1,1
%>
第三步:建立asp与access的联系,循环将刚刚数据集中的内容填入access表中,具体代码:
<%
set accessconn=server.createobject("adodb.connection")
strAddr2 = Server.MapPath("test.mdb")
accessconn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strAddr2
do while not excelrs.eof
'此处只做了一个字段的例子,假定你的access中表名为excel
addsql="insert into excel(num1) values('"& excelrs("num1")&"')"
excelrs.movenext
loop
%>
第四步:如果有问题可以联系我,然后如果有效,请加分给我,谢谢。
9. asp图片批量上传问题源码
启科网络ASP图片或文件批量上传程序
下载地址:
http://download.csdn.net/down/2676247/cgndg