大文件分段上传
の吟清手記
我是風中的落葉,看我如何飛翔 I'm a leaf on the wind,watch how i soar.- 理想空間
- Blog
- XNA
- Tags
- Selected Content
- Guestbook
- Link
- Music
- Login
一段方便的ASP無組件上傳程序
[ 2005-07-04 20:41:51 | Author: 吟清 ] Font Size: Large | Medium | Small 最近比較忙,我的Blog已經(jīng)有兩天沒有更新了。現(xiàn)在貢獻一段上傳代碼,希望可以對大家有所幫助。我最近在做一個商品發(fā)布系統(tǒng)需要上傳商品圖片,雖然以前也寫過一個采用無組件上傳的圖片上傳程序,但是過了這么久代碼都找不到了(PS:習慣不太好,沒有整理代碼的習慣,呵呵!!!)還要重新寫我當然沒有這么笨了,當然是去網(wǎng)上盜了。 [lol]
我從網(wǎng)上下載一個商城系統(tǒng)得到這樣幾個頁面是上傳圖片的,我精簡了一下,現(xiàn)在發(fā)布供大家參考。
up.asp
建立一個上傳圖片的文件夾uploadfiles <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--
=================== Aspid =======================
http://www.aspid.cn/
Author: 吟清
Last Update: 2005-07-04
===============================================
?-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ASPid - 上傳圖片</title>
</head>
<body><form name="formname" method="post" action="saveaddbook.asp?action=add" OnSubmit="return checkkk()" >
<input name="upfile" type="text" id="upfile" size="30">
?<input name="upbtn" type="button" id="upbtn" onClick="window.open('upload.asp?formname=formname&editname=upfile&uppath=uploadfiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" value="上傳圖片">
</form>
</body>
</html>
upload.asp
<%
uppath=request("uppath")&"/"??????'文件上傳路徑
filelx=request("filelx")????????'文件上傳類型
formName=request("formName")??????'回傳到上頁面編輯框所在Form的Name
EditName=request("EditName")??????'回傳到上頁面編輯框的Name
%>
<html><head><title>ASPid - 圖片上傳</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
function mysub()
{
????esave.style.visibility="visible";
}
-->
</script>
</head>
<body>
<form name="form1" method="post" action="upfile.asp" enctype="multipart/form-data" >
<div id="esave" style="position:absolute; top:18px; left:40px; z-index:10; visibility:hidden">
?<TABLE WIDTH=340 BORDER=0 CELLSPACING=0 CELLPADDING=0>
?<TR><td width=20%></td>
?<TD bgcolor=#003366 width="60%">
?<TABLE WIDTH=100% height=100 BORDER=0 CELLSPACING=1 CELLPADDING=0>
<TR>
<td bgcolor=#ffffff align=center><font color=#003366>正在上傳文件,請稍候...</font></td>
</tr>
</table>
</td><td width=20%></td>
</tr></table></div>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
?<td align="center" bgcolor="#003366"><b><font color="#ffffff">圖片上傳
?<input type="hidden" name="filepath" value="<%=uppath%>">
<input type="hidden" name="filelx" value="<%=filelx%>">
<input type="hidden" name="EditName" value="<%=EditName%>">
<input type="hidden" name="FormName" value="<%=formName%>">
<input type="hidden" name="act" value="uploadfile">
?</font></b> </td>
</tr>
<tr bgcolor="#E8F1FF">
<td align="center" id="upid" height="80">選擇文件:
<input type="file" name="file1" size="40" class="tx1" value="">
<input type="submit" name="Submit" value="開始上傳" class="button" οnclick="javascript:mysub()">
</td>
</tr>
</table>
</form>
</body>
</html>
upfile.asp
<!--#include file="upload.inc"-->
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
??filepath=trim(upload.form("filepath"))
??filelx=trim(upload.form("filelx"))
??
??i=0
??for each formName in upload.File
????set file=upload.File(formName)
?
?fileExt=lcase(file.FileExt)??'得到的文件擴展名不含有.
?if file.filesize<100 then
??response.write "<script language=javascript>alert('請先選擇你要上傳的文件!');history.go(-1);</script>"
??response.end
?end if
?if (filelx<>"swf") and (filelx<>"jpg") then
??response.write "<script language=javascript>alert('該文件類型不能上傳!');history.go(-1);</script>"
??response.end
?end if
?if filelx="swf" then
??if fileext<>"swf" then
????response.write "<script language=javascript>alert('只能上傳swf格式的Flash文件!');history.go(-1);</script>"
????response.end
??end if
?end if
?if filelx="jpg" then
??if fileext<>"gif" and fileext<>"jpg" then
????response.write "<script language=javascript>alert('只能上傳jpg或gif格式的圖片!');history.go(-1);</script>"
????response.end
???end if
?end if
?if filelx="swf" then
??if file.filesize>(3000*1024) then
????response.write "<script language=javascript>alert('Flash文件大小不能超過3m!');history.go(-1);</script>"
????response.end
??end if
?end if
?if filelx="jpg" then
??if file.filesize>(1000*1024) then
????response.write "<script language=javascript>alert('圖片文件大小不能超過1m!');history.go(-1);</script>"
????response.end
??end if
?end if
?randomize
?ranNum=int(90000*rnd)+10000
?filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
%>
<%
?if file.FileSize>0 then ''如果 FileSize > 0 說明有文件數(shù)據(jù)
?'file.SaveAs Server.mappath(filename) ''保存文件
?file.SaveToFile Server.mappath(FileName)
?'response.write file.FileName&" 上傳成功! <br>"
?'response.write "新文件名:"&FileName&"<br>"
?'response.write "新文件名已復制到所需的位置,可關閉窗口!"
?if filelx="swf" then
?response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(file.FileSize/1024)&" K'</script>"
?end if
?response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
%>
<%
end if
set file=nothing
next
set upload=nothing
end if
%>
<script language="javascript">
window.alert("文件上傳成功!");
window.close();
</script>
最后一個upload.inc是一個無組件上傳
<%
'----------------------------------------------------------------------
'轉發(fā)時請保留此聲明信息,這段聲明不并會影響你的速度!
'******************* 無組件上傳類 ********************************
'修改者:梁無懼
'原作者:稻香老農
'文件屬性:例如上傳文件為c:/myfile/doc.txt
'FileName 文件名 字符串 "doc.txt"
'FileSize 文件大小 數(shù)值 1210
'FileType 文件類型 字符串 "text/plain"
'FileExt 文件擴展名 字符串 "txt"
'FilePath 文件原路徑 字符串 "c:/myfile"
'使用時注意事項:
'由于Scripting.Dictionary區(qū)分大小寫,所以在網(wǎng)頁及ASP頁的項目名都要相同的大小
'寫,如果人習慣用大寫或小寫,為了防止出錯的話,可以把
'sFormName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
'改為
'(小寫者)sFormName = LCase(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
'(大寫者)sFormName = UCase(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
'**********************************************************************
'----------------------------------------------------------------------
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.copyto oFileStream,FileSize
?oFileStream.SaveToFile FullPath,2
?oFileStream.Close
?set oFileStream=nothing
?SaveToFile=0
?end function
End Class
%>
這個梁無懼修改的0.96化境編程界無組件上傳類,大家可千萬不要使用這個版本的。
舊版本的無組件上傳中有很大的漏洞,給黑客上傳“木馬”、“病毒”開了方便之門,問題主要是出在電腦不能正確判斷含有“/0”二進制字符文件名或路徑,可以本地抓包嗅探流文件并用二進制編輯器偽裝IP包通過網(wǎng)絡軍刀上傳,你使用這樣的上傳類等于是給黑客開了后門.
一定要去下載新的上傳類,無懼無組件上傳類已經(jīng)更新到2.2版本了,網(wǎng)上還有流行的先鋒無組件上傳類(杜絕上傳漏洞版),你去下載下試試,再稍加修改這幾段程序就可以使用了。 [Last Modified By 吟清, at 2006-06-03 23:07:34] <script type="text/javascript"></script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script> name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-6787035091819389&dt=1164830080343&lmt=1164830080&format=468x60_as&output=html&url=http%3A%2F%2Fwww.aspid.cn%2Fblog%2Farticle.asp%3Fid%3D93&color_bg=FFFFFF&color_text=B5B56A&color_link=99A189&color_url=99A189&color_border=FFFFFF&ad_type=text_image&ref=http%3A%2F%2Fwww.google.com%2Fsearch%3Fhl%3Dzh-CN%26newwindow%3D1%26q%3D.net%2B%2B%2B%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25A0%25E7%25BB%2584%25E4%25BB%25B6%25E5%2588%2586%25E6%25AE%25B5%25E4%25B8%258A%25E4%25BC%25A0%26btnG%3D%25E6%2590%259C%25E7%25B4%25A2%26lr%3Dlang_zh-CN&cc=100&u_h=800&u_w=1280&u_ah=772&u_aw=1280&u_cd=32&u_tz=480" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"> 本文遵循創(chuàng)作共用版權協(xié)議, 要求署名、非商業(yè)用途和保持一致.
請尊重作者勞動成果,轉載本文必須遵循“署名-非商業(yè)用途-保持一致”的創(chuàng)作共用協(xié)議.
This Article is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. Tags: ASP 無組件上傳 Comments Feed: http://www.aspid.cn/blog/feed.asp?q=comment&id=93 Relate Articles
- 談點想法:Asp學習者選看-Asp初學者提綱
- 談點想法:Asp學習者選看-對Asp入門者的建議
- 如何確保應用系統(tǒng)的安全
- Response對象的使用詳解
- 超強:單文件的ASP文章管理系統(tǒng)
<script language="javascript" src="common.js" type="text/javascript"></script> View Mode: Show All | Comments: 32 | Trackbacks: 0 | Toggle Order | Views: 8534 aspcn [ 2005-08-05 11:49:48 ] 你好,我是一個asp初學者,剛才看了你發(fā)表的一篇無組件上傳的代碼,我加以修改但是在上傳以后,在web在線編輯框內顯示是的絕對路徑,怎么把它改為相對路徑.
例如:
我上傳圖片時的路徑是:
<img src=UploadFiles/200584182625498.jpg>
可是在上傳完后路徑變?yōu)?#xff1a;
<IMG src="http://localhost/UploadFiles/200584175323951.jpg">
我現(xiàn)在想要路徑保存為
<IMG src="UploadFiles/200584175323951.jpg">
不知改怎么改動。
希望站長大哥,給小弟指點一二。
qingis* [ 2005-08-05 22:32:49 ] 在這里
http://localhost/UploadFiles/200584175323951.jpg
是絕對路徑
而UploadFiles/200584175323951.jpg
是相對路徑,
如果你把在本機上測試的程序傳上去并打開瀏覽,
如果可以正常瀏覽,
圖片路徑為http://www.yourname.com/UploadFiles/200584175323951.jpg
表示這仍舊是相對路徑,不需要修改。
如果還是http://localhost/UploadFiles/200584175323951.jpg這個路徑,
那你再提出來,我們一起去解決這個問題。 aspcn [ 2005-08-06 11:13:12 ] 本機上測試的程序?
不好意思,站長在那呀!我有點糊涂不明白!
能教我該怎樣做嗎! qingis* [ 2005-08-07 16:55:34 ] 你的程序是在哪里測試的~是不是在自己的機器上測試呢,如果把你的程序上傳到服務器上去,再打開測試一下.如果圖片路徑不是http://localhost/UploadFiles/200584175323951.jpg這個路徑,那就對了. aspcn [ 2005-08-19 12:15:26 ] 站長,你好這么多天沒來!實在是太忙了不好意思! [sweat]
我把程序按照你說的上傳了。圖片路徑為http://localhost/UploadFiles/200584175323951.jpg
但是我在IIs里把網(wǎng)站的默認IP一改就成了http://192.168.1.66/UploadFiles/200584175323951.jpg
所以十分郁悶!不知道是那段代碼實現(xiàn)讀取網(wǎng)站名稱的! aspcn [ 2005-08-19 12:32:59 ] 噢!還有我忘了給站長大哥說了就是我用的是下面的這段上傳代碼:
http://www.blueidea.com/bbs/NewsDetail.asp?id=2130645
和你發(fā)表的類似。
現(xiàn)在就是在在web在線編輯框內顯示是的絕對路徑,怎么把它改為相對路徑。
請站長大哥幫我看看,跪求指點迷津! 吟清 [ 2005-08-19 12:46:48 ] 它現(xiàn)在保存就是"UploadFiles/200584175323951.jpg"這個路徑,所以你根本不需要去修改,而且不管你在什么場合都不影響你使用.所以你只管放心使用就行了. aspcn [ 2005-08-25 17:17:31 ] 是的保存路徑是UploadFiles/200584175323951.jpg
可是在鏈接顯示圖片時圖片屬性顯示鏈接地址為:http://192.168.1.66/UploadFiles/200584175323951.jpg
這在局域網(wǎng)內瀏覽可以顯示,但是一上公網(wǎng)圖片就不能顯示。原因是找不到鏈接的192.168.1.66主機這是當然得了!
我現(xiàn)在就是想讓它的鏈接地址為:
http://UploadFiles/200584175323951.jpg
這樣不論公網(wǎng)局域網(wǎng)就能正常顯示了。
我想知道讀取http://192.168.1.66的這段代碼在程序的那個地方這樣就好改了。
謝謝!站長大哥的點撥!請您多費心了! lizhe [ 2005-10-31 10:55:29 ] 各位大哥,大姐們,小弟我做了個網(wǎng)站,就是圖片不能上傳,在本地測試成功,但是上傳到遠端就無法實現(xiàn)了,我知道可能是服務器環(huán)境改變了,但是不知道如何修改,求大哥,大姐們指點指點!!
提示錯誤:
Server.MapPath() error 'ASP 0171 : 80004005'
Missing Path
/dianzishangwu/xrclass23/upload.asp, line 26
The Path parameter must be specified for the MapPath method. aspid* [ 2005-10-31 11:29:50 ] 按照你提示的錯誤代碼應該是遠端服務器路徑設置的問題.
你最好把你出錯的代碼貼出來。 talix [ 2005-11-27 11:08:47 ] 大姐 我也是一樣的問題 成功的可以上傳文件 保存到指定文件夾中 只是在網(wǎng)站圖片管理中 怎么可以把 圖片名稱 圖片上傳放一個頁面中操作 好一起插入 數(shù)據(jù)庫 不知道 怎么解決 得到上傳后圖片的文件名 然后和別的圖片數(shù)據(jù)保存到數(shù)據(jù)庫中。。。。。多謝了 吟清 [ 2005-12-19 15:29:11 ] 你在數(shù)據(jù)庫中建立一個表,分別建立id,圖片路徑,上傳日期,幾個字段。
然后在程序中設計一段獲取圖片上傳路徑等信息程序,然后添加到數(shù)據(jù)庫中。就可以了。 talix [ 2006-01-02 22:29:41 ] 全解決了 多謝 自己磨了半個月 哈 全成功了
有空來我做好的網(wǎng)頁瞧瞧吧 www.pzpxd.com 吟清 [ 2006-01-02 23:41:27 ] For talix:
派中派鞋店是你的干的,還是耐品是你服務的公司啊. fyabc* [ 2006-04-23 09:45:08 ] 無法顯示網(wǎng)頁
試圖訪問的網(wǎng)頁出現(xiàn)問題,無法顯示。
--------------------------------------------------------------------------------
請嘗試執(zhí)行下列操作:
單擊刷新按鈕,或稍后重試。
打開 localhost 主頁,然后查找與所需信息相關的鏈接。
HTTP 錯誤 500.100 - 內部服務器錯誤 - ASP 錯誤
Internet 信息服務
--------------------------------------------------------------------------------
技術信息(用于支持人員)
錯誤類型:
ADODB.Stream (0x800A0BBC)
寫入文件失敗。
/up/Upload.Inc, 第 174 行
瀏覽器類型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
網(wǎng)頁:
POST 38790 ??? /up/Upfile.Asp
POST Data:
錯誤 '80020009'
發(fā)生意外。
/iisHelp/common/500-100.asp,行 219 fyabc* [ 2006-04-23 09:45:51 ] 我把你的代碼拷貝下來!不行啊! 吟清 [ 2006-04-23 14:37:57 ] 查看一下文件上傳的路徑是否正確,是否存在該路徑! flyabc* [ 2006-04-24 09:43:12 ] 太謝謝您了!行了! flyabc* [ 2006-04-24 09:46:17 ] 我把upload.inc文件換成
無懼上傳類 v2.2
好像又不可以用了!
無法顯示網(wǎng)頁
試圖訪問的網(wǎng)頁出現(xiàn)問題,無法顯示。
--------------------------------------------------------------------------------
請嘗試執(zhí)行下列操作:
單擊刷新按鈕,或稍后重試。
打開 localhost 主頁,然后查找與所需信息相關的鏈接。
HTTP 錯誤 500.100 - 內部服務器錯誤 - ASP 錯誤
Internet 信息服務
--------------------------------------------------------------------------------
技術信息(用于支持人員)
錯誤類型:
Microsoft VBScript 運行時錯誤 (0x800A01FA)
類沒有被定義: 'upload_file'
/up/Upfile.Asp, 第 3 行
瀏覽器類型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
網(wǎng)頁:
POST 38790 ??? /up/Upfile.Asp
POST Data:
. . .
時間:
2006年4月24日, 9:46:00
詳細信息:
Microsoft 支持 fyabc [ 2006-04-24 09:48:38 ] 如果新版您本能修改一下就好了! 吟清 [ 2006-04-24 10:30:42 ] 新版的無懼上傳類變量,參數(shù)都有所不同,以前修改過一個,不知道發(fā)布到哪里了!(知道我沒有整理代碼的習慣)
只能重新做了!只量最近時間不夠,有空了一定重新改一下,到時你就能看到了!
不好意思哦!! [Last Modified By 吟清, at 2006-04-24 10:31:41] fyabc [ 2006-04-27 08:43:36 ] 我會常來的!
==========
zhai [ 2006-05-07 17:17:42 ] 無法顯示網(wǎng)頁
試圖訪問的網(wǎng)頁出現(xiàn)問題,無法顯示。
--------------------------------------------------------------------------------
請嘗試執(zhí)行下列操作:
單擊刷新按鈕,或稍后重試。
打開 localhost 主頁,然后查找與所需信息相關的鏈接。
HTTP 錯誤 500.100 - 內部服務器錯誤 - ASP 錯誤
Internet 信息服務
--------------------------------------------------------------------------------
技術信息(用于支持人員)
錯誤類型:
ADODB.Stream (0x800A0BBC)
寫入文件失敗。
/up/Upload.Inc, 第 174 行
瀏覽器類型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
網(wǎng)頁:
POST 38790 ??? /up/Upfile.Asp
POST Data:
錯誤 '80020009'
發(fā)生意外。
/iisHelp/common/500-100.asp,行 219
我也出現(xiàn)了這個問題,我在根目錄下建立了一個uploadfiles文件夾,我的up.asp、upfile.asp、upload.asp、upload.inc文件都在根目錄下。請站長幫忙解決以下謝謝。 zhai [ 2006-05-07 17:32:46 ] 呵呵 我的問題解決了,是權限問題。謝謝 iwalker [ 2006-06-03 03:14:48 ] 請問我想上傳后立刻顯示在
<input name="imageshow" type="image" width="130" height="98">
里是如何做到的..我改好幾處地方了?還是不可以
以下是upfile.asp修改的代理,相信我是沒有拼錯字等問題的
response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
我加的代碼,是這樣的嗎?
response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("ImageName")&".src='"&FileName&"'</script>" 吟清 [ 2006-06-03 03:19:22 ] 如果讀取路徑正確一般沒什么問題!
你檢查一下顯示方式和數(shù)據(jù)傳遞!試試! iwalker [ 2006-06-03 03:23:04 ] 可以加我QQ嗎?
我想發(fā)我改了代碼給你..謝謝
QQ:445178
你的Email也可以..我發(fā)給你看...
檢查了..就是不可以,希望你可以幫幫忙..
asp還是新學的..不太會... [Last Modified By iwalker, at 2006-06-03 03:33:48] iwalker [ 2006-06-03 03:24:47 ] 這么夜了還在?嘻嘻..又是一個夜游人
在嗎?
我是Email是 andylife@tom.com [Last Modified By iwalker, at 2006-06-03 03:32:40] iwalker [ 2006-06-03 17:35:45 ] 請幫幫忙..試了好多次了.還是不行..求助... 吟清 [ 2006-06-03 23:59:31 ] 我也嘗試了很長時間也無法解決,可能是文本域的src無法傳遞吧!
你可以在up.asp修改如下: <img name="upfile" id="upfile" width="130" height="98">
在upfile.asp做如下修改就可以了! response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".src='"&FileName&"'</script>"
希望有高手可以詳細解答一下關于文本域傳遞的方法! [Last Modified By 吟清, at 2006-06-04 00:00:17] iwalker [ 2006-06-05 03:00:25 ] 利害..沒有想到這一點..現(xiàn)在我問題可以解決了..
不過還是想知道為何 <input>是不行的..
thanks
會常來的.... 吟清 [ 2006-06-05 03:06:57 ] 又是這么晚啊!呵呵!
有空經(jīng)常交流,謝謝支持!
<script language="javascript" src="messageform.js" type="text/javascript"></script>
User Panel
Categories
- Index
- News [11]
- Resources Share [24]
- Developer [92]
- Web Design [22]
- Art Design [27]
- Digital [12]
- Log [42]
- Goods [20]
Calendar
| ? 2005 ? ?? ? July ? | ||||||
| Su | Mo | Tu | We | Th | Fr | Sa |
| ? | ? | ? | ? | ? | 1 | 2 |
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 | ? | ? | ? | ? | ? | ? |
Recent Articles
- 世界上最經(jīng)典的感情短語
- 雜志征名!
- 索愛w700c入手,推薦一個可解...
- 關于LBS作者SIC的消息
- LBS樣式三欄修改自適應寬度
- 測試你的殺毒軟件的功力
- Cookies在ASP中的操作
- 網(wǎng)絡公司樣本設計
- 愛有天意,不可不信緣
- 從論壇發(fā)展漫談WEB開發(fā)語言!
Recent Comments
- Only a small fraction o...
- 很不錯的哦~如果可以就發(fā)...
- 路過這里,網(wǎng)站建設的不錯...
- 下載不了~~~ 能發(fā)給我一...
- 分析的有道理 我的站現(xiàn)...
- Find the best place to ...
- 用ie7瀏覽你的站,圖片都...
- 我需要一個 謝謝 kmlyzy@...
- 我的博客http://www.yesk...
- 有些東西不是說放棄就能...
Search
Hot Tags
設計[26] ASP[24] TSYS[13] Blog[12] Flash[10] 網(wǎng)站[10] php[7] 企業(yè)[7] 網(wǎng)頁[7] 插畫[7] CMS[7] Google[6] LBS[6] SQL[5] 數(shù)碼[5] 事業(yè)[4] 數(shù)據(jù)庫[4] 錯誤[4] 搜索[4] 韓國[4] XML[3] 計劃[3]More Tags..
推薦使用Firefox瀏覽本站
<script type="text/javascript"></script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script> name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/cpa/ads?client=ca-pub-6787035091819389&cpa_choice=CAAQs8X8zwEaCF3TsUAWCLVXKPu_93M&oe=utf-8&dt=1164830081890&lmt=1164830081&format=180x60_as_rimg&output=html&url=http%3A%2F%2Fwww.aspid.cn%2Fblog%2Farticle.asp%3Fid%3D93®ion=_google_cpa_region_&ref=http%3A%2F%2Fwww.google.com%2Fsearch%3Fhl%3Dzh-CN%26newwindow%3D1%26q%3D.net%2B%2B%2B%25E5%25A4%25A7%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25A0%25E7%25BB%2584%25E4%25BB%25B6%25E5%2588%2586%25E6%25AE%25B5%25E4%25B8%258A%25E4%25BC%25A0%26btnG%3D%25E6%2590%259C%25E7%25B4%25A2%26lr%3Dlang_zh-CN&cc=100&u_h=800&u_w=1280&u_ah=772&u_aw=1280&u_cd=32&u_tz=480" frameborder="0" width="180" scrolling="no" height="60" allowtransparency="allowtransparency">About me
這里是吟清的個人Blog, 在這里您好可以了解吟清的工作與生活,想法及心情,如果你對吟清感興趣,可以瀏覽吟清的照片如果您喜歡我的Blog可以通過您的RSS閱讀器訂閱我的Feed. 如果您有什么問題請到Gbook給吟清捎個話,或者加入吟清的QQ,也可以發(fā)Email給吟清.本Blog建立于2005年6月2日,目前已有 250 篇日志,有 3527157 人到訪, 有 326 個用戶 發(fā)表了 812 篇評論 ; 當前有 21 人與您同時關注這個Blog.
Links
排名不分先后添加時間排序==== ◎ Bloger ====
- の吟清手記
- Break N
- Syosyume's Blog
- 墨水,要多喝
- Novem’s blog
- Black-Xstar's BLOG
- Tug的平凡生活
- 幻想冬天
- tomorrow
- lording's blog
- 落入凡間的帶魚
- AXFLY.COM
- [劍氣]凌人℡-Blog
- 咖啡のBar
- 布拉格公園
- 布拉格是張床
- 專注 PHP ACTIONScript — LZYY
- H.Strong&Christine
- Fantastic Day
- 蔣曉磊的靜默空間
- 微翔在線
- greengnn's space
- KeKe's Blog
- LEE'S BLOG
- eTech.Blog
- HAoZi
- Binken's Blog
- 埃爾維斯
- 鐘愛夢欣
- 小楊的網(wǎng)絡日志
- 巴哥哥和巴姐姐的窩
- Charles Blog
- CrazyParty @blog
- 鬼仔's Blog
- D.JOY
- 狄加小窩
- LUSIN BLOG
- 緣·空間
- 城市漫延
- Tony的筆記
- I eric
- 風無痕
- OnLing's Blog
- GIDot de 豬娃娃
- 孤單城市
- zheman's Blog
- 色·情·罐頭
- 大懶人的布拉格
- 碎月無痕
- 苕上耕夫
==== ◎ Links ====
BXNA
ZDNet CN
Alexa
我的音樂收藏夾
Last Modified 06/06/02
Apply Links:申請友情鏈接
聯(lián)系站長QQ:86565882
MSN:qingis@hotmail.com
Gmail:xingis@gmail.com
浙ICP備05041413號11 DB Queries | Proccessed in 204ms
?
?
完整代碼列表
WebForm1.aspx
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CSharpUpload.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
? <HEAD>
??? <title>WebForm1</title>
??? <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
??? <meta name="CODE_LANGUAGE" Content="C#">
??? <meta name=vs_defaultClientScript content="JavaScript">
??? <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
? </HEAD>
? <body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
<INPUT type=file id=File1 name=File1 runat="server" >
<br/>
<input type="submit" id="Submit1" value="Upload" runat="server" NAME="Submit1">
</form>
? </body>
</HTML>
?
WebForm1.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace CSharpUpload
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlInputFile File1;
protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{???
this.Submit1.ServerClick += new System.EventHandler(this.Submit1_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
if( ( File1.PostedFile != null ) && ( File1.PostedFile.ContentLength > 0 ) )
{
string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
string SaveLocation = Server.MapPath("Data") + "//" +? fn;
try
{
File1.PostedFile.SaveAs(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch ( Exception ex )
{
Response.Write("Error: " + ex.Message);
}
}
else
{
Response.Write("Please select a file to upload.");
}
}
}
}
href="/favicon.ico" rel="shortcut icon" /> href="/favicon.ico" rel="Bookmark" />?
|
| |||||||||
| ||||||||||
| ? | ||||||||||
| ? |
|
|
| ? |
| <script src="http://news.newhua.com/JS/AdsJS/2.js" type="text/javascript"></script> |
<script language="JavaScript" type="text/javascript"> function doZoom(size){ document.getElementById('zoom').style.fontSize=size+'px' } </script>
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? |
| Copyright (C) 1997,2005 《華軍軟件園》OnlineDown.NET 本主頁保留所有權利。 京ICP備05004773號 京ICP證050203 本站特聘法律顧問:于國富律師 |
| ? |
總結
- 上一篇: ABAQUS 工程仿真分析基础入门到精通
- 下一篇: H3C SE 教程笔记——构建安全优化的