⑴ 求一個圖片展示的網站源碼或程序,要支持分類瀏覽
這個網站里的資源不錯 但是都的消費 300ym 各種類型整站無錯程序
最方便的是沒個網站都有演示 售後服務也很好,我當時就是找了很多源碼 找了半天都不好用,最後也是在網路里搜索到 這個站了。我覺得花幾百元值了。不必再試用半天的程序,還都是壞了。→真心推薦 網路 300ym
⑵ 求一個能上傳小說和圖片的網站源碼
這是我用的asp的,圖片存在UpImages文件下,圖片文件存在數庫里,別外你自添加數據連接吧;
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>寫日記</title>
<% if session("user")="" then
response.write"非法操作"
response.end
end if
%>
<link href="Css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
td { font-size: 12px; line-height: 18px; border-style: none; color: #333333}
body {
background-image: url(image/94d48012f93a637cf819b897.jpg);
}
.STYLE10 {font-size: 10px; font-family: "宋體"; }
.STYLE12 {font-size: 12px; font-family: "楷體_GB2312"; }
-->
</style></head>
<!--#include file="Conn.asp"-->
<body>
<table width="800" border="0" align="center" cellspacing="0">
<tr>
<th align="right" scope="col"> <span class="STYLE12">
<script language="JavaScript" type="text/javascript">
var pp,mm,month;
mydate=new Date();
pp=mydate.getDay();
month=mydate.getMonth()+1;
switch(pp)
{case 0: mm="星期日";break;
case 1: mm="星期一";break;
case 2:mm="星期二";break;
case 3: mm="星期三";break;
case 4: mm="星期四" ;break;
case 5 : mm="星期五";break;
case 6 : mm="星期六";break;
}
document.write("今天是:"+mydate.getYear()+"年"+month+"月"+mydate.getDate()
+"日"+" "+mm+" ");
</script>
</span></th>
</tr>
<tr>
<th height="40" scope="col"><img src="image/top.gif" width="800" height="157" alt="書叢製作" /></th>
</tr>
<tr>
<td height="25" align="center" background="image/ph.gif">寫文章</td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCFFFF"><form action="write.asp?action=Addnew" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="138" align="right">文章標題:</td>
<td colspan="2"><label>
<input name="title" type="text" id="title" />
</label></td>
</tr>
<tr>
<td align="right"></td>
<td width="236"><label></label>
<label for="file"></label>
<input type="file" name="file" id="file" /></td>
<td width="426"> 心情狀態:
<select name="select">
<option value="一般" selected="selected">一般</option>
<option value="非常愉快">非常愉快</option>
<option value="愉快">愉快</option>
<option value="不好">不好</option>
<option value="失落">失落</option>
</select></td>
</tr>
<tr>
<td align="right">文章內容:</td>
<td colspan="2"><label>
<textarea name="content" cols="80" rows="20" id="content"></textarea>
</label></td>
</tr>
<tr>
<td align="right">操作:</td>
<td colspan="2"><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table width="800" border="0" align="center" cellspacing="0">
<tr>
<th height="3" scope="col"><hr size="1" /></th>
</tr>
</table>
<table width="800" border="0" align="center" cellspacing="0">
<tr>
<th align="center" scope="col"><span class="STYLE10">Copyright 2009 ? www.pttjj.com.cn All Rights Reserved.<br />
版權所有: | 技術支持:<a href="mailto:[email protected]">書叢</a> | 渝ICP備000**0號 </span></th>
</tr>
</table>
<%
if request("action") = "Addnew" then
newline = chrB(13) & chrB(10) 'newline表示二進制的回車符
filesize = Request.TotalBytes 'filesize是表單數據大小
filedata = Request.BinaryRead(filesize) 'filedata是表單的二進制數據
divider = leftB(filedata,clng(instrb(filedata,newline))-1) 'divider是分割符
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From word"
Rs.Open Sql,conn,3,3
Rs.addnew
k = 1
While instrb(k,filedata,divider) < instrb((instrb(k,filedata,divider)+lenb(divider)),filedata,divider)
start = instrb(k,filedata,divider) + lenb(divider) +2
endsize = instrb((instrb(k,filedata,divider) + lenb(divider)),filedata,divider) - start - 2
content = midb(filedata,start,endsize) '取文件說明部分
start_name = instrb(content,toByte("name="""))
end_name = instrb(start_name + 6,content,toByte(""""))
nametag = midb(content,start_name+6,end_name-start_name-6) '取文件說明部分中name=""中的內容,即表單元素的名稱
pos1_filename = instrb(end_name,content,toByte("filename="""))
'如果是文件框,則文件說明部分應有filename="",那麼pos1_filename不等於0
If pos1_filename = 0 Then '表單中不屬於文件上傳的數據處理
namevalue = toStr(midb(content,end_name+5,lenb(content)-end_name-4)) '取文件內容
' 將文件說明部分的name=""中的內容與表單元素的名稱進行比較,把相應的內容加入資料庫
If(InStr(toStr(nametag),"file") > 0)Then 'CenterID2'為表單控制項的name屬性值,以下同
Rs("image") = namevalue
session("CenterID") = namevalue '用於上傳文件保存時的文件名中
End If
If(InStr(toStr(nametag),"title") > 0)Then
Rs("title") = namevalue
if namevalue="" then
Response.Write "<Script>alert('請輸入標題!')</Script>"
response.end
end if
End If
If(InStr(toStr(nametag),"content") > 0)Then
Rs("content") = namevalue
if namevalue="" then
Response.Write "<Script>alert('請輸入內容!')</Script>"
response.end
end if
End If
If(InStr(toStr(nametag),"select") > 0)Then
Set Rs1 = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From mun"
Rs1.Open Sql,conn,3,3
Rs1("mun")=namevalue
Rs1.update
Rs1.Close
Set Rs1=nothing
End If
Rs("wtime") = year(now)&"-"&month(now)&"-"&day(now)
'Response.Write (namevalue)
'Response.Write(" <br>")
else '處理文件上傳部分的數據
pos2_filename = instrb(pos1_filename+10,content,toByte(""""))
fullpath = midb(content,pos1_filename+10,pos2_filename-pos1_filename-10) '從文件說明部分中取出文件路徑
covername=GetFileName(toStr(fullpath))
If(fullpath <> "")Then '如果有上傳的文件,執行以下代碼
dim bStart ' 取二進制流文件部分開始位置
bStart = instrb(start,filedata,newline&newline)+3
dim bEnd ' 取二進制流文件部分結束位置
bEnd=inStrB(bStart+6,filedata,divider)-bStart-3
dim stm ' 定義一個 adodb.stream 源對象 stm, 用以拷貝二進制流文件部分至另一 adodb.stream fromStm
set stm=createObject("adodb.stream")
stm.type=1 ' 二進制模式
stm.mode=3 ' 指定打開模式為讀寫
stm.open
stm.write filedata '寫入二進制流內容
dim fromStm '定義 adodb.stream 對象 fromStm, 以保存文件
set fromStm=createOBject("adodb.stream")
with fromStm
.type=1
.mode=3
.open
stm.position = bStart ' 指定 stm 對象的起始位置, 以變數 bStart 的值為起始位置
stm.To fromStm, bEnd ' 拷貝 stm 二進制流至 fromStm 對象, 長度為 bEnd 變數的長度
.saveTofile server.MapPath (covername),2' 保存文件, 如果存在相同名稱, 則覆蓋
.close
end with
set fromStm = nothing
stm.close
set stm = nothing
Rs("image") =covername '將文件的相對路徑寫入資料庫中
end if
end if
k = instrb((instrb(k,filedata,divider)+lenb(divider)),filedata,divider)
Wend
Rs.update
Rs.close
set Rs = nothing
response.Redirect"mylife.asp"
end if
function toStr(Byt) '將二進制轉換為字元串
toStr=""
for i=1 to lenb(byt)
blow = midb(byt,i,1)
if ascb(blow)>127 then
toStr = toStr&chr(ascw(midb(byt,i+1,1)&blow)) '
i = i+1
else
toStr = toStr&chr(ascb(blow))
end if
Next
End function
Function toByte(Str) '將字元串轉換為二進制
dim i,iCode,c,iLow,iHigh
toByte=""
For i=1 To Len(Str)
c=mid(Str,i,1)
iCode =Asc(c)
If iCode <0 Then iCode = iCode + 65535
If iCode>255 Then
iLow = Left(Hex(Asc(c)),2)
iHigh =Right(Hex(Asc(c)),2)
toByte = toByte & chrB("&H"&iLow) & chrB("&H"&iHigh)
Else
toByte = toByte & chrB(AscB(c))
End If
Next
End function
Function GetFileName(imagespath)'將路徑轉換為時間,並使上傳的文件不重名
If imagespath <> "" Then
rname=right(toStr(fullpath),len(toStr(fullpath))-InStrRev(toStr(fullpath),".")+1)'獲得後綴名
GetFileName = "UpImages/" & year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rname
Else
GetFileName =""
End If
End Function
%>
</body>
</html>
⑶ 求一個圖片展示的網站源碼或程序,要支持分類瀏覽 最好是php環境的
以前下了個用織夢做的圖片站程序 挺簡潔的 效果如圖
⑷ asp上傳圖片源碼
<%
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="Version 2004"
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,".") '重要修改,防止黑客"\0"斷名偽裝!!!
tmpPath=nohack(0)&"."&nohack(ubound(nohack)) '重要修改,防止黑客"\0"斷名偽裝!!!
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,".") '重要修改,防止黑客"\0"斷名偽裝!!!
tmpPath=nohack(0)&"."&nohack(ubound(nohack)) '重要修改,防止黑客"\0"斷名偽裝!!!
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
'----------------------------------------------------------------------------------------------------
'文件屬性類
Class clsFileInfo
Dim FormName,FileName,FilePath,FileSize,FileMIME,FileStart,FileExt
End Class
%>
⑸ 圖片上傳的ASP源代碼
4個文件實現無組件上傳4個文件實現無組件上傳
嵌套式調用:
<iframe name="ad" frameborder=0 width=100% height=50 scrolling=no src=uploada.asp></iframe>
直接鏈接:uploada.asp
文件保存路徑:upload
上傳文件類型和大小自己設置
===========================================
第一個文件:inc/confing.asp(inc為文件夾名稱)
<%
Const EnableUploadFile="Yes" '是否開放文件上傳
Const MaxFileSize=200 '上傳文件大小限制
Const UpFileType="gif|jpg|bmp|png|swf|doc|txt|rar|zip" '允許的上傳文件類型
%>
===========================================
第二個文件:inc/upload.asp
dim oUpFileStream
Class upload_file
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="無組件上傳類 Version 0.96"
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
iFormEnd = oUpFileStream.Size
bCrLf = chrB(13) & chrB(10)
'取得每個項目之間的分隔符
sStart = MidB(RequestBinDate‚1‚ InStrB(1‚RequestBinDate‚bCrLf)-1)
iStart = LenB (sStart)
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‚sStart)-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 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)
oFileInfo.FileExt = GetFileExt(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 -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
form.Add sFormName‚sFormvalue
end if
tStream.Close
iFormStart = iFormStart+iStart+2
'如果到文件尾了就退出
loop until (iFormStart+2) = iFormEnd
RequestBinDate=""
set tStream = nothing
End Sub
Private Sub Class_Terminate
'清除變數及對像
if not Request.TotalBytes<1 then
oUpFileStream.Close
set oUpFileStream =nothing
end if
Form.RemoveAll
File.RemoveAll
set Form=nothing
set File=nothing
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
'取得擴展名
Private function GetFileExt(FullPath)
If FullPath <> "" Then
GetFileExt = mid(FullPath‚InStrRev(FullPath‚ ".")+1)
Else
GetFileExt = ""
End If
End function
End Class
'文件屬性類
Class FileInfo
dim FormName‚FileName‚FilePath‚FileSize‚FileType‚FileStart‚FileExt
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
FileType = ""
FileExt = ""
End Sub
'保存文件方法
Public function SaveToFile(FullPath)
dim oFileStream‚ErrorChar‚i
SaveToFile=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
SaveToFile=0
end function
End Class
%>
========================================
第三個文件:uploada.asp
<!--#include file="Inc/config.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
BODY{
BACKGROUND-COLOR: #f5feed;
font-size:9pt
}
.tx1 { height: 20px;font-size: 9pt; border: 1px solid; border-color: #000000; color: #0000FF}
-->
</style>
<link href="Manage/Inc/ManageMent.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%
if EnableUploadFile="Yes" then
%>
<form action="upfilea.asp" method="post" name="form1" enctype="multipart/form-data">
<input name="FileName" type="FILE" class="tx1" size="20">
<input type="submit" name="Submit" value="上傳" style="border:1px double rgb(88‚88‚88);font:9pt">
</form>
<%
end if
%>
</body>
</html>
============================
第四個文件:upfilea.asp
<!--#include file="Inc/config.asp"-->
<!--#include file="Inc/upload.asp"-->
<%
const upload_type=0 '上傳方法:0=無懼無組件上傳類,1=FSO上傳 2=lyfupload,3=aspupload,4=chinaaspupload
dim upload‚file‚formName‚SavePath‚filename‚fileExt
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg‚founderr
msg=""
founderr=false
EnableUpload=false
SavePath = "Upload" '存放上傳文件的目錄
if right(SavePath‚1)<>"/" then SavePath=SavePath&"/" '在目錄後加(/)
%>
<%
ComeinSTR=lcase(request.servervariables("HTTP_HOST"))
Url=split(ComeinSTR)
yourthing=Url(0)
%>
<html>
<head>
<link href="Manage/Inc/ManageMent.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
if EnableUploadFile="NO" then
response.write "系統未開放文件上傳功能"
else
select case upload_type
case 0
call upload_0() '使用化境無組件上傳類
case else
end select
end if
%>
</body>
</html>
<%
sub upload_0() '使用化境無組件上傳類
set upload=new upload_file '建立上傳對象
for each formName in upload.file '列出所有上傳了的文件
set file=upload.file(formName) '生成一個文件對象
if file.filesize<100 then
msg="請先選擇你要上傳的文件!"
founderr=true
end if
if file.filesize>(MaxFileSize*1024) then
msg="文件大小超過了限制,最大隻能上傳" & CStr(MaxFileSize) & "K的文件!"
founderr=true
end if
fileExt=lcase(file.FileExt)
Forumupload=split(UpFileType‚"|")
for i=0 to ubound(Forumupload)
if fileEXT=trim(Forumupload(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
EnableUpload=false
end if
if EnableUpload=false then
'msg="這種文件類型不允許上傳!\n\n只允許上傳這幾種文件類型:" & UpFileType
response.write"<script language=javascript>alert('這種文件類型不允許上傳!\n\n只允許上傳這幾種文件類型:" &
UpFileType & "');"
response.write"javascript:history.go(-1)</script>"
founderr=true
end if
strJS="<script language=javascript>" & vbcrlf
if founderr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
file.SaveToFile Server.mappath(FileName) '保存文件
msg="上傳文件成功!"
FileType=right(fileExt‚3)
select case FileType
case "jpg"‚"gif"‚"png"‚"bmp"
case "swf"
case else
strJS=strJS & "range.text=' 點擊瀏覽該文件';" & vbcrlf
end select
end if
strJS=strJS & "alert('" & msg & "');" & vbcrlf
strJS=strJS & "</script>"
response.write strJS
response.write "圖片上傳成功!文件路徑是 /" & filename & "<br>"
response.write "http://";; & yourthing & "/" & filename & "<br>"
set file=nothing
next
set upload=nothing
end sub
%>
⑹ 我有個圖片要上傳替換到網站源代碼
你這段代碼中壓根就不包含圖片,你可以把整個文件發出來,幫你看下怎麼修改!
⑺ 如何在網頁實現上傳各種文件或圖片視頻等功能
回答如下:
1、無組件上傳系統,只要空間支持ASP,就可以使用,一般不會和空間沖突。
2、一般來說,你下載的源碼中都是含有使用方法的,我大致說一下吧:
比如你圖上的3個腳本,你可以在index.asp中放置一個表單,表單的提交(action="upload.asp")指向upload.asp腳本。在upload.asp腳本中,你需要調用upload_class.asp這個文件(這個文件定義的是一個上傳類和一些參數的介面),通過定義的參數和表單提交來的信息,獲取到文件的相關信息,比如大小、文件名等。
這2個文件里應該會有詳細的說明啊,我當時就是看了這個說明使用的。很好用哦
⑻ 求一個圖片管理系統或開源相冊,支持無限分類和tag標簽
推薦使用Gallery,是一個專業的圖片管理軟體。。。
相關介紹:
Gallery是一款基於WEB的軟體。它使得你可以對自己網站中的相片進行管理。你的網站必須有PHP和資料庫的支持來安裝和使用Gallery。通過使用Gallery,你能輕松地在一個直觀的界面中創建和維護相冊。相片管理包括縮略圖的自動創建,圖像尺寸重設,旋轉,排序,字幕及搜索等。相冊和相片可以進行查看和刪除。通過身份驗證的用戶還可以擁有其他的許可權,從而獲取額外的隱私保護。它具有很好的社群向 - 將帳號分配給你的朋友與家人。然後他們就可以在你的網站里上傳和管理自己的相片了。
⑼ 請問,上傳圖片的源代碼怎麼寫還有,怎麼上傳本地圖片
文章里貼圖有兩種方法: 1,網路圖片鏈接:在文章編輯時,點擊上面功能區中的「插入圖片」在對話框中粘貼網路圖片地址,確定即可顯示。鉤選顯示源代碼即可看到「圖片的源代碼」。 2,本地上傳圖片:編輯文章時,點擊下面的「圖片剪貼板」—瀏覽—找到你計算機中准備好的圖片後,選中確定,然後隨游標插入圖片即可。需要注意的是本地上傳圖片要求一定是「jpg和gif格式的,容量不能超過200KB」。 上面的兩種方法都可以使用,而且鉤選顯示源代碼,都可以看到圖片添加的代碼,復制下來就可以了。
⑽ 做個昵圖,我圖網類型的網站,求源碼!急!
已經發送