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