淘宝过户需要多久:我想上传的文件以源文件名为文件名?以下这段代码是以系统的时间为文件名!

来源:百度文库 编辑:高考问答 时间:2024/05/13 14:23:58
' ============================================
' 获取时间整数串 作为文件名称
' ============================================
Private Function GetTimeStr()
LngTime = LngTime + 1
GetTimeStr = StrDate & LngTime
End Function

Private Function GetFerr(LngFsiz, StrFext)
Dim IntFerr
IntFerr = 0
If LngFsiz > P_MaxSize And P_MaxSize > 0 Then
If P_Error = 0 Or P_Error = 2 Then P_Error = P_Error + 1
IntFerr = IntFerr + 1
End If
If InStr(1, LCase("/" & P_FileType & "/"), LCase("/" & StrFext & "/")) = 0 And P_FileType <> "" Then
If P_Error < 2 Then P_Error = P_Error + 2
IntFerr = IntFerr + 2
End If
GetFerr = IntFerr
End Function
' ============================================
' 保存文件,成功保存返回Ture,否则返回False
' ============================================
Public Function Save(Item, StrFnam)
Rem ******************************************
Rem Item是表单中file元素
Rem Name是保存的文件名,可选值:
Rem 0:自动取无重复的服务器时间字符串为文件名
Rem 1:自动取源文件名
Rem ******************************************
Save = False
If ObjForm.Exists(Item & "_From") Then
Dim IntFerr, StrFext
StrFext = ObjForm(Item & "_Ext")
IntFerr = GetFerr(ObjForm(Item & "_Size"), StrFext)
If ObjForm.Exists(Item & "_Err") Then
If IntFerr = 0 Then
ObjForm(Item & "_Err") = 0
End If
Else
ObjForm.Add Item & "_Err", IntFerr
End If
If IntFerr <> 0 Then Exit Function
If VarType(StrFnam) = 2 Then
Select Case StrFnam
Case 0
StrFnam = GetTimeStr()
If StrFext <> "" Then StrFnam = StrFnam & "." & StrFext
Case 1
StrFnam = ObjForm(Item & "_Name")
End Select
End If
BinItem.Type = 1
BinItem.Open
BinForm.Position = ObjForm(Item & "_From")
BinForm.CopyTo BinItem,ObjForm(Item & "_Size")
BinItem.SaveToFile Server.MapPath(P_SavePath & StrFnam), 2
BinItem.Close()
If ObjForm.Exists(Item) Then
ObjForm(Item) = StrFnam
Else
ObjForm.Add Item, StrFnam
End If
Save = True
End If
End Function

??