当前位置: 网学 > 编程文档 > ASP > 正文

为SWFUpload增加ASP版本的上传处理程序

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/16
xt
End Function

Private Function ByteToStr(byVal sByte)
Dim streamTmp
Set streamTmp = Server.CreateObject("ADODB.Stream")
streamTmp.Type = 2
streamTmp.Mode = 3
streamTmp.Open
streamTmp.WriteText sByte
streamTmp.Position = 0
streamTmp.CharSet = "utf-8"
streamTmp.Position = 2
ByteToStr = streamTmp.ReadText
streamTmp.Close
Set streamTmp = Nothing
End Function

Private Function GetClientName(byVal bInfo)
Dim sInfo, regEx
sInfo = ByteToStr(bInfo)
If IsNothing(sInfo) Then
GetClientName = ""
Else
Set regEx = New RegExp
regEx.Pattern = "^.*\\([^\\]+)$"
regEx.Global = False
regEx.IgnoreCase = True
GetClientName = regEx.Replace(sInfo, "$1")
Set regEx = Nothing
End If
End Function

Private Function GetParentFolder(byVal sPath)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(.*)\\[^\\]*$"
regEx.Global = True
regEx.IgnoreCase = True
GetParentFolder = regEx.Replace(sPath, "$1")
Set regEx = Nothing
End Function

Private Function CreateFolder(byVal sLine, byVal sPath)
Dim oFso
Set oFso = Server.CreateObject("Scripting.FileSystemObject")
If Not oFso.FolderExists(sPath) Then
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(.*)\\([^\\]*)$"
regEx.Global = False
regEx.IgnoreCase = True
sLine = sLine & regEx.Replace(sPath, "$2") & "|"
sPath = regEx.Replace(sPath, "$1")
If CreateFolder(sLine, sPath) Then CreateFolder = True
Set regEx = Nothing
Else
If sLine = "|" Then
CreateFolder = True
Else
Dim sTemp : sTemp = Mid(sLine, 2, Len(sLine) - 2)
If InStrRev(sTemp, "|") = 0 Then
sLine = "|"
sPath = sPath & "\" & sTemp
Else
Dim Folder : Folder = Mid(sTemp, InStrRev(sTemp, "|") + 1)
sLine = "|" & Mid(sTemp, 1, InStrRev(sTemp, "|") - 1) & "|"
sPath = sPath & "\" & Folder
End If
oFso.CreateFolder sPath
If CreateFolder(sLine, sPath) Then CreateFolder = True
End if
End If
Set oFso = Nothing
End Function

REM CLASS-TERMINATE

Private Sub Class_Terminate
streamGet.Close
Set streamGet = Nothing
End Sub

End Class

REM 调用方法
Dim oUpload
Set oUpload = New SWFUpload
oUpload.SaveFolder = "存放路径"
oUpload.GetUploadData
Set oUpload = Nothing
%>

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号