Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408339
  • 博文数量: 403
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -70
  • 用 户 组: 普通用户
  • 注册时间: 2016-09-05 12:45
文章分类

全部博文(403)

文章存档

2014年(3)

2013年(1)

2012年(3)

2011年(21)

2010年(13)

2009年(64)

2008年(9)

2007年(36)

2006年(253)

分类:

2006-09-16 18:01:30

ASP实现上传文件功能
(1)asp+发送email
html1.htm
 ---------------------------------------------------------------------
 
 
 
 
 
 
 

 发送邮件给:

 
 
 
 
 
 emal.aspx
 ---------------------------------------------------------------------
 <%@ Import Namespace="System.Web.Util" %>
 
 
 
 ASP+邮件发送
 
 
 
 一封HTML格式邮件发送到了:
 

<% response.write(request.form("mailto")) %>


 
 
 
 
 --------------------------------------------------------------
 我注意到了3点问题:
 
 System.Web.Util
 居然在vs7的msdn library里面没有找到这个内容 :(
 所以没法了解更多详细内容了。
 
 为了让程序发送邮件,你必须开启smtp server,并正确设置之
 微软只使用自己的东西,这一点让我感觉很不爽。
 我使用的是拨号,用mmc编辑smtp server的属性,绑定smtp服务到我拨号时候获得的IP上,就能成功发送邮件了。
 
 让程序正确使用中文
 你必须在当前web目录的config.web中加上下列语句
  requestencoding="gb2312"
 responseencoding="gb2312"
 />
 或者你也可以
 修改winnt\complus\v2000.14.1812目录中的config.web文件
  requestencoding="gb2312"
 responseencoding="gb2312"
 />
 
 
(2)用ASP和VBScript上载文件(一)

从浏览器上载文件是从客户机向服务器传递文件的一个简易方法。从第三代浏览器Netscape和 Microsoft起,多数浏览器都可以向服务器上载文件,而不需要向用户提供特殊的访问方式或软件。
一些ASP组件是为文件上载而设计的,例如:
Posting Acceptor
( Microsoft SiteServer的一部分),
AspSmartUpload(Advantys),
AspUpload (PersistsSoftware),
SA-FileUpSoftware Artisants)
  本文的开始将告诉你关于创建这类组件的信息,而这些组件通常使用VB、C++或Java。
  这些组件的问题在于它们是第三方产品而非标准ASP的一部分。作为第三方组件,必须在服务器上进行安装。这就意味着必须在服务器上复制DLL并注册。大多数的主机系统不允许在他们的服务器上进行这样的设置,因为有可能发生配置问题(尤其是虚拟主机)。第二个缺点是它们大部分不是免费的,不提供源代码,也就不能根据需要进行定制。
  因此我需要编写VBScript代码来解决文件上载的问题。这不是一个必然的选择,因为VBScript是一种脚本语言,只能使用variants数据类型,并且不能提供许多管理二进制数据和字节数组的内置函数。
  要理解上载的过程,首先要知道数据用HTTP协议从浏览器发送到服务器的方式。这就意味着要理解“ multipart/form-data” (多部分/格式-数据)的表单提交。
上载表单
  通常情况下,使用HTML表单从浏览器向服务器传递数据。这个表单中可能包含文本域、检验框、按钮以及上载文件的文件类型控制。使用者用自己的数据填充并将这个表提交给服务器。
  表单元素中的 enctype 属性规定了传递给服务器的表数据集编码的内容类型。enctype 属性的默认值是“application/x-www-form-urlencoded”,但当向服务器传送大量文本、包含非ASCII字符或二进制数的数据时,这个默认类型就不能胜任了。这时,文件上载提交表单时应使用“multipart/form-data”内容类型。
  一个“multipart/form-data”信息包含一系列部件,每个部件都可能包含:
一个Content-Disposition(内容-处理)头,其值为"form-data" ;一个规定控制名的name(名称)属性。
  对于一个文件类型控制,一个部件可能包含更多信息:
在客户机上规定原始路径和文件名的filename(文件名)属性;所发送的二进制数据控制的Content-Type (内容-类型)头。
  在这些头的后面跟随着控制的二进制或文本内容。
  以下例子说明“multipart/form-data”的编码,客户机的浏览器应有这个表单:
如果这个表单被提交,在服务器上可读到这些请求:
-----------------------------7cf87224d2020a
Content-Disposition: form-data; name="email"

-----------------------------7cf87224d2020a
Content-Disposition: form-data; name="blob"; filename="c:image.gif"
Content-Type: image/pjpeg
-----------------------------7cf87224d2020a
Content-Disposition: form-data; name="Enter"
Submit Query
-----------------------------7cf87224d2020a--
  当那个内容作为响应被传送回客户机时就会被显示出来。应该用Request.binaryRead 和Response.binaryWrite 方法读和写二进制数据。
〈%
Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))
%〉
可以看到响应的各部分用分界线来划分:
-----------------------------7cf87224d2020a
最后一个分界线后面跟随的是’ -- ’ 。
  每一个控制都有一个Content-Disposition 。name属性识别由HTML表发送的控制(email、blob和Enter)。 对于一个文件类型控制(blob),
文件名也是Content-Disposition 头的一部分,Content-Type 头给出二进制 数据的内容类型。
上载脚本
  上面所有内容都必须经过分解。在VB 或 C++中, 这非常明显,因为为此提供了许多对象和方法。在VBScript 中,必须使用语言所提供的一些函数,并要解决VBScript中使用的双字节编码的变量字符串的问题。
VBScript函数
  原始数据是二进制格式,所以必须使用专为管理二进制数据而设计的VBScript函数。因为我们将原始数据作为一个字节的字符串来考虑, 所以 MidB、InstrB 和 LenB 函数就有用了。 但是要避免VBScript的classic字符串,因为它们是双字节编码的字符串,不适宜分解成单字节。
  这些是VBScript函数中仅有的用来分解字节的函数。还需要一个方法,从被分解的数据中得到双字节编码的字符串,这样就可以使用VBScript编码中的字符串了。为了在InstrB中把字符串作为一个自变量使用,还需要一个函数,把双字节字符串转换成单字节字符串。
  为了我写了两个函数,getString() 和 getByteString(),稍后再对此进行解释。
结构
  分解的数据被存储在VBScript Dictionary 对象中。 Dictionary 对象是hash 表对象,它存储(key, item)对。它是VBScript和ASP2.0的一部分。
  定义第一个Dictionary 对象 " UploadRequest " 。这个对象包含由上载表提交的所有控制。Key是控制的名字,Item则是对象中所包含的控制的信息:
"ControlName1", Dictionary control1
"ControlName2", Dictionary control2
  代表一个控制的Dictionary 对象包含着下面的(key, item) 对:
"Value", String or binary content
"FileName", Name of uploaded file
"ContentType", ContentType of uploaded file
  把这些结合起来,就有以下例子:
UploadRequest : "email", UploadControl 1 : "Value",
"blob" , UploadControl 2 : "filename", C:/image/file.gif "ContentType" :
image/gif "Value" : GIF89ai?
这个对象对于以后存取和使用数据非常有用。
分解
  这里是分解、读和记录上载控制的代码。这个过程用"BuildUploadRequest"程序来完成,这个程序只有一个自变量,就是原始二进制数据RequestBin。
Sub BuildUploadRequest(RequestBin)
  首先要找到分界线,通过分界线可以知道控制循环何时结束。
’Get the boundary PosBeg = 1 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg) boundaryPos = InstrB(1,RequestBin,boundary)
  有一个问题是InstrB需要单字节字符串作为自变量。为此写了一个函数:getByteString(String) ,此方法可以把VBScript的双字节字符串转换成单字节字符串。在代码解释的最后再描述这个函数。
在找到结束分界线之前进行下列循环:
’Get all data inside the boundaries
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
  循环中的每一步都处理一个控制。有关这一控制的所有数据都保存在dictionary对象中。每一个循环创建一个新的dictionary对象UploadControl。
’Members variable of objects are put in a dictionary object Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
  首先从" Content-Disposition " 头中找到控制的名字。名字的结尾用"字符或chr(34)划分。
’Get an object name Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name=")) PosBeg = Pos+6 PosEnd
= InstrB(PosBeg,RequestBin,getByteString(chr(34))) Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
  现在测试控制是文件类控制还是文本类控制。如果是文本类控制,除了它的名字以外没有其它任何数据。 如果是文件类控制,就会得到一些额外信息,如文件名和Content-Type。
PosFile=InstrB(BoundaryPos,RequestBin,getByteString("filename=")) PosBound
= InstrB(PosEnd,RequestBin,boundary) ’Test if object is of file type If
PosFile〈〉0 AND (PosFile〈PosBound)
  Then 如果是控制是文件类控制,就将路径和文件名进行分解,并将他们填加到控制的dictionary 对象中。分解后的文件名是一个单字节字符串,要将它转换成双字节字符串才能作为variant字符串变量使用。这通过最后定义的getString()方法来实现:
’Get Filename, content-type and content of file PosBeg = PosFile + 10 PosEnd
= InstrB(PosBeg,RequestBin,getByteString(chr(34))) FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
’Add filename to dictionary object UploadControl.Add "FileName", FileName
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:")) PosBeg =
Pos+14 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) ’Add content-type
to dictionary object ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
  UploadControl.Add "ContentType",ContentType 现在就可以得到文件的核心内容了。这个内容不需要转换,因为它是二进制的。可以将它存入一个文件系统或作为一个二进制长对象(blob)放入数据库中。
’Get content of object PosBeg = PosEnd+4 PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
  Else 如果是文本类控制,除了内容以外就没有其它数据需要分解。内容要转换成为双字节字符串,以便将来用 在VBScript代码中。
’Get content of object Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4 PosEnd = InstrB(PosBeg,RequestBin,boundary)-2 Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
End If
  将内容加入dictionary对象中。将key设置成 " Value ",那么item 就是内容。根据控制类型的不同,内容可以是字符串或二进制数据。
’Add content to dictionary object
UploadControl.Add "Value" , Value
  最后将控制的dictionary 对象加入一个全程dictionary 对象中。使用的key 是控制的名字。item 是刚刚创建的dictionary对象,名为UploadControl。
’Add dictionary object to main dictionary UploadRequest.Add name, UploadControl
’Loop to next object BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop End Sub
字节-字符串转换函数
下面是将双字节字符串转换成单字节字符串的函数。
’Byte string to string conversion Function getString(StringBin) getString
="" For intCount = 1 to LenB(StringBin) getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next End Function 下面是将字符串转换成单字节字符串的函数,它用来格式化InstrB函数的自变量。
’String to byte string conversion Function getByteString(StringStr) For
i = 1 to Len(StringStr) char = Mid(StringStr,i,1) getByteString = getByteString
& chrB(AscB(char)) Next End Function
 
 
 
 (3)用ASP和VBScript上载文件(二)
上载脚本的使用
  下面是开发的上载脚本的应用范例。本文的下载文件提供例子中的文件和代码。将压缩文件释放到一个路径下,为你的网络服务器配置一个虚拟路径。可以在浏览器中测试和启动uploadForm.html。
调用脚本
  下面是调用上载BuildUploadRequest 方法的途径。首先调用一个全程dictionary:UploadRequest。然后调用BuilUploadRequest方法,然后在自变量中传送到请求原始二进制数据。
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
数据被分解并存储在dictionary对象中,并用Item() 方法恢复。这些item 数据可以保存在VBScript 变量中,并且可以在代码的任何地方使用。数据可以作为响应传送回客户机,或用在ASP代码中,或写进文件中及放入数据库中。
取回数据
  UploadRequest 对象的数据可用Item("key") 函数进行存取。现在来考虑一下这样的情况:要存取一个 email控制的值。可以这样做:
email = UploadRequest.Item("email").Item("Value")
  因为这是一个文本类控制,内容是一个字符串,这个字符串可以同任何其它VBScript 字符串一样使用。 对于二进制数据,可以用相同方法恢复内容:
picture = UploadRequest.Item("blob").Item("Value")
  也可以存取其它信息,如文件名和content-type。他们是文本类控制。
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
在 VBScript 代码中使用数据
上载的数据可以同其它变量一样在VBScript 代码中使用。比如说,它们可以作为响应发送回客户机。
Your email is : 〈%=email%〉
File name of you picture is 〈%=filepathname%〉
File type of your picture is 〈%=contentType%〉
二进制数据也可以发送回客户机。必须设置一个content-type,可以用BinaryWrite 方法写二进制数据。
Response.ContentType = contentType Response.BinaryWrite picture
向文件中写入上载数据
在文件类控制的情况下,目的通常是将二进制数据存入某个文件或数据库域,而不是将它们传送回客户机。这个目的是上载文件的固有特点。使用FileSystem对象将上载文件存入服务器的文件系统中。
首先创建FileSystem对象:
’Create FileSytemObject Component Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
用FileSystem对象在路径中创建一个文件。路径可以是绝对的,直接指向文件系统(如c: emp)。也可以是相对的,到网络服务器定义的一个虚拟路径下。用mappath方法和PATH_INFO服务器变量将虚拟路径影射到绝对路径。
Write方法需要一个双字节字符串作为自变量,所以要将单字节数列转换成字符串。Write方法负责转换这个双字节字符串,并用ASCII 格式写它。这就建立了一个包含我们原始的单字节字符串的二进制内容的文件。我已将这个文件命名为“uploaded+filename”,这只是为了区别文件,你可以使用任何其它文件名,如:
’Create and Write to a File Set MyFile = ScriptObject.CreateTextFile(Server.mappath(Request.ServerVariables _ ("PATH_INFO")) & "uploaded" & filename)
For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value, i, 1)))
Next
MyFile.Close
将上载数据存入数据库
数据还可以被存入数据库。content-type 也应该存入数据库中,以便以后显示数据。首先要建立与数据库的连接,假定已经设置了适当的DSN:
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=wroxdns","user","pass"
然后从连接中创建记录集:
sql = "SELECT PHOTO, CONTENTTYPE FROM MYTABLE"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 3, 3
记录集创建之后,要将二进制数据放入数据库的blob域中:
picturechunk = picture & chrB(0)
rs.Fields("PICTURE").appendChunk picturechunk
rs.Fields("CONTENTTYPE") = contentType
rs.Update
conn.close
在appendChunk 方法中,我不得不解决一个臭虫。事实上我注意到,当二进制数据有奇数字节时,appendChunk 方法就不传送最后一个字节。解决的办法是增加一个chr(0),以确保传送了所有的字节。也许还有其它办法,如果有的话,请告诉我。
要得到数据库的映象,使用相同的记录集,并用正确的内容类型将它作为响应发送回客户机。
Response.contentType = rs.Fields("CONTENTTYPE")
size = rs.Fields("PICTURE").ActualSize
blob = rs.Fields("PICTURE").GetChunk(size)
Response.binarywrite blob
结论
  本文展现了一个完整的用VBScript 进行文件上载的方法。编码完全是VBScript ,独立于第三方产品。
  首先集中介绍上载的过程(用" multipart/form-data "型内容进行HTML传递)。然后详细介绍上载的 VBScript代码。开始时对操作字符串和单字节数列的VBScript函数进行简要回顾。然后介绍了脚本的代码 以及上载数据的结构。
  最后显示了这个脚本的多个用途,从使用ASP代码中的上载变量到数据库或文件系统中存储上载文件。
 
 
(4)无组件上传例子

不用组件上载文件代码具体例子
2001:8:16 

不用组件上载文件代码具体例子
下面的第一个例子为只是将客户端的文件上传到服务端的例子
第二个例子为将文件内容保存入数据库中。
文件fupload.asp
<%
dim ResultHTML
'Some value greater than default of 60s (According to upload size.)
'The maximum speed is about 100kB/s for IIS4, P200 and local upload, 4kB/s for modem users.
Server.ScriptTimeout = 400
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then 'Request method must be "POST" for get the fields
' BeginTimer 'Starts timer.
 '*************************************************  Main Upload - start
  Dim Fields
'  on error resume next
  'Set upload limit to 10M
  UploadSizeLimit = 10000000
  'Gets uploaded fields
  Set Fields = GetUpload()
  'There are all of form fields in the Fields object. Example :
  'Fields("File1").ContentType - content type of File1 field
  'Fields("File1").Value - Binary value of File1 field
  ResultHTML = ""
  If Err = 0 Then 'Upload was OK
   'Write statistics about upload
   dim Field
   For Each Field In Fields.Items
    ResultHTML = ResultHTML & "
Field : " & LogF(Field.name) & ", Length : " & LogFn(Field.Length) & ", Content-Type : " & LogF(Field.ContentType) & ", SourceFileName :?b>" & LogF(Field.FileName) & ""
   Next
   'Saves the fields to the disk, writes result to the client and writes log.
   'See utils.inc. You can change the function to save the files to another location.
   ResultHTML = ResultHTML & "
" & SaveUpload(Fields, Server.MapPath("."), LogFolder)
  Else 'Error in upload. Write the error
   ResultHTML = ResultHTML & "
Error : " & Err.Description
  End If
  On Error GoTo 0
  Fields = Empty 'Clear the variable
 '*************************************************  Main Upload - end
' EndTimer 'Writes info about consumed time.
End If 'Request method must be "POST"
%>

<%'upload.inc, contains GetUpload function, Required for upload - only the one file%>

<%'utils.inc, contains SaveUpload function%>

<%'format.inc, contains head and Foot function, optional.%>

<%=Head("Sample multiple binary files upload via ASP", "Demonstrates using of the ByteArray class for working with binary data from Request.BinaryRead.")%>

 
  
  
  
  
  
  
 

   

   

    File???input type="file" name="File1">
    File???input type="file" name="File2">
   

   

    add a file
   

  
Checkbox
Password
Comments
Description


?%=ResultHTML%>

<%=Foot%>
文件fdbutl.asp将文件内容保存如数据库中
<%'upload.inc, contains GetUpload function, Required for upload - only the one file%>

<%'format.inc, contains head and Foot function, optional.%>

<%=Head("Sample database upload via ASP", "Demonstrates using of the ByteArray class for working with binary data from Request.BinaryRead.")%>

 
  
  
  
  
 
File to upload
Title
Description
<%=Foot%>
 
 

(5)支持中文的无组件上传例子
支持中文的无组件文件上传-- 示例
 
来源:chinaasp
作者: woozhj

文件:uploadtest.asp


Untitled Document



 

text1:
  
 


 

text2:
  
 


 

txtarea:
  
 


 

file:
  
 


 


  
  
 




文件:showdata.asp

  <%
   'Fields("xxx").Name 取得Form中xxx(Form Object)的名字
   'Fields("xxx").FilePath 如果是file Object 取得文件的完整路径
   'Fields("xxx").FileName 如果是file Object 取得文件名
   'Fields("xxx").ContentType 如果是file Object 取得文件的类型
   'Fields("xxx").Length 取得Form中xxx(Form Object)的数据长度
   'Fields("xxx").Value 取得Form中xxx(Form Object)的数据内容
   Dim FormData,FormSize
   FormSize=Request.TotalBytes
   FormData=Request.BinaryRead(FormSize)
   Set Fields = GetUpload(FormData)
   response.write "text1:" & Fields("text1").Value & "
" & VbCrLf
   response.write "text2:" & Fields("text2").Value & "
" & VbCrLf
   response.write "textarea:" & Fields("textfield").Value & "
" & VbCrLf
   response.write Fields("newfile").FileName
   response.write Fields("newfile").ContentType
   Response.ContentType = Fields("newfile").ContentType
   If Fields("newfile").FileName<>"" Then
     Response.ContentType = Fields("newfile").ContentType
     response.binarywrite Fields("newfile").Value
   End If
   
   'Response.BinaryWrite FormData
  %> 
 

(6)计算文件下载时间
计算文件下载时间

<%
Function DownloadTime(intFileSize, strModemType)
Dim TimeInSeconds, ModemSpeed, strDownloadTime, AppendString
Dim intYears, intWeeks, intDays
Dim intHours, intMinutes, intSeconds
intYears = 0
intWeeks = 0
intDays = 0
intHours = 0
intMinutes = 0
intSeconds = 0
strDownloadTime = ""
Select Case strModemType
Case "Cable"
ModemSpeed = 400000
Case "56kbps"
ModemSpeed = 7000
Case "33.6kbps"
ModemSpeed = 4200
Case "28.8kbps"
ModemSpeed = 3600
End Select
TimeInSeconds = int(intFileSize / ModemSpeed)
'year maths added 1/4 of a day. 1 exact orbit of the sub is 365.25 days.
If (Int(TimeInSeconds / 31471200) <> 0) Then intYears = Int(TimeInSeconds / 31449600)
If ((Int(TimeInSeconds / 604800) Mod 52) <> 0) Then intWeeks = Int(TimeInSeconds / 604800) Mod 52
If ((Int(TimeInSeconds / 86400) Mod 7) <> 0) Then intDays = Int(TimeInSeconds / 86400) Mod 7
If TimeInSeconds >= 3600 Then intHours = Int(TimeInSeconds / 3600) Mod 24
If TimeInSeconds >= 60 Then intMinutes = Int(TimeInSeconds / 60) Mod 60
If TimeInSeconds >= 0 Then intSeconds = Int(TimeInSeconds) Mod 60
If intYears <> 0 Then
If intYears = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intYears & " year" & AppendString & ", "
End If
If intWeeks <> 0 Then
If intWeeks = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intWeeks & " week" & AppendString & ", "
End If
If intDays <> 0 Then
If intDays = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intDays & " day" & AppendString & ", "
End If
If intHours <> 0 Then
If intHours = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intHours & " hour" & AppendString & ", "
End If
If intMinutes <> 0 Then
If intMinutes = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intMinutes & " minute" & AppendString
End If
If ((intYears = 0) And (intWeeks = 0) And (intDays = 0) And (intHours = 0)) Then
If intSeconds = 1 Then AppendString = "" Else AppendString = "s"
If intMinutes > 0 Then
strDownloadTime = strDownloadTime & ", " & intSeconds & " second" & AppendString
Else
strDownloadTime = strDownloadTime & intSeconds & " second" & AppendString
End If
End If
DownloadTime = strDownloadTime
End Function
%>


It is going to take about
<%=DownloadTime(123456,Cable)%> to download this file.

 
 
(7)无组件上传文件代码段
不用组件上载文件代码段
 
  下面将介绍一系列可以不用组件,而使用纯粹的ASP代码来上传文件
呵呵,我想这将给很多拥有个人主页的网友带来极大的方便。
  这个纯ASP代码由三个包含文件组成,代码中只使用了FileSystemObject
和Direction两个ASP固有对象。而不需要任何附加的组件,注意,为了保证
这段代码的出处,我没有对代码中的任何地方进行过修改。
  希望能够对大家有所帮助:
文件fupload.inc

 
文件futils.inc
 
文件fformat.inc
 
 
阅读(3116) | 评论(0) | 转发(0) |
0

上一篇:ASP教程

下一篇:10天学会ASP.NET

给主人留下些什么吧!~~