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

php中关于普通表单多文件上传的处理方法

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/21
GetClientName(bInfor) & extenArr(iCount)
End If
End If
dataStart(iCount) = itemStart(i) + iStart - 2
dataLength(iCount) = iLength
End If
Else
extenArr(iCount) = ""
httpArr(iCount) = ""
itemData(iCount) = ByteToStr(MidB(dataPart, iStart, iLength))
dataStart(iCount) = ""
dataLength(iCount) = ""
End If
iCount = iCount + 1
Next
Call ItemToColl
End Function

Private Function GetItemName(byVal bName)
GetItemName = ByteToStr(bName)
End Function

Private Function ItemToColl
For i = 0 To itemCount - 1
If Not Form.Exists(itemName(i)) Then
Form.Add itemName(i), itemData(i)
End If
Next
End Function

Private Function FileExtenName(byVal bInfor)
Dim pContent, regEx
pContent = GetClientPath(bInfor)
If IsNothing(pContent) Then
FileExtenName = ""
Else
Set regEx = New RegExp
regEx.Pattern = "^.+(\.[^\.]+)$"
regEx.Global = False
regEx.IgnoreCase = True
FileExtenName = regEx.Replace(pContent, "$1")
Set regEx = Nothing
End If
End Function

Private Function GetHttpContent(byVal bInfor)
Dim sInfor, regEx
sInfor = ByteToStr(bInfor)
Set regEx = New RegExp
regEx.Pattern = "^[\S\s]+Content-Type:([\S\s]+)$"
regEx.Global = False
regEx.IgnoreCase = True
GetHttpContent = Trim(regEx.Replace(sInfor, "$1"))
Set regEx = Nothing
End Function

Private Function GetRandomName(byVal sLen)
Dim regEx, sTemp, arrFields, n : n = 0
Set regEx = New RegExp
regEx.Pattern = "[^\d]+"
regEx.Global = True
regEx.IgnoreCase = True
sTemp = regEx.Replace(Now, "") & "-"
Set regEx = Nothing
arrFields = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", _
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", _
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t", _
"u", "v", "w", "x", "y", "z", "A", "B", "C", "D", _
"E", "F", "G", "H", "I", "J", "K", "L", "M", "N", _
"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", _
"Y", "Z")
Randomize
Do While n < sLen
sTemp = sTemp & CStr(arrFields(61 * Rnd))
n = n + 1
Loop
GetRandomName = sTemp
End Function

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

Private Function GetClientPath(byVal bInfor)
Dim sInfor, pStart, pLength, pContent
sInfor = ByteToStr(bInfor)
pStart = InStr(1, sInfor, "filename=" & Chr(34)) + 10
pLength = InStr(pStart, sInfor, Chr(34)) - pStart
pContent = Mid(sInfor, pStart, pLength)
GetClientPath = pContent
End Function

Public Function SaveUploadFile
Dim isValidate
Dim filePath, oStreamGet, oStreamPut
isValidate = fPassed And CheckFile
If isValidate Then
For i = 0 To itemCount - 1
If Not IsNothing(dataStart(i)) And Not IsNothing(dataLength(i)) Then
If dataLength(i) = 0 Then
itemData(i) = ""
Else
filePath = Server.MapPath(itemData(i))
If CreateFolder("|", ParentFolder(filePath)) Then
Set oStreamGet = Server.CreateObject("ADODB.Stream")
oStreamGet.Type = 1
oStrea

网学推荐

免费论文

原创论文

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