|
大小!" Return False End If Else ErrMsg = "对不起,只允许上传以下格式的文件" & LocAllowExtFile & "!" Return False End If End If End If Else ErrMsg = "上传目录未设置" Return False End If Return True End Function
''''----------------------------------------------------------------------------------------- ''''功能说明:根据日期和时间得到一个不重复的随机数文件名 ''''----------------------------------------------------------------------------------------- Public Function GetRandomFileName(ByVal strFileName As String, ByVal strExtName As String) As String
Dim tempFileName As String Dim Ext As String tempFileName = CStr(Now()) tempFileName = Replace(tempFileName, "-", "") tempFileName = Replace(tempFileName, ":", "") tempFileName = Replace(tempFileName, " ", "") tempFileName = tempFileName & GetRandomNumber(1, 1000) GetRandomFileName = tempFileName & strExtName End Function ''''---------------------------------------------------------------------------------------- ''''功能说明:获取指定上下限内的随机数 ''''----------------------------------------------------------------------------------------- Public Function GetRandomNumber(Optional ByVal Low As Integer = 1, Optional ByVal High As Integer = 100) As Integer Dim oRandom As System.Random oRandom = New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer)) Return oRandom.Next(Low, High + 1) End Function ''''------------------------------------------------------------------------------------ ''''功能说明:根据文件名,得到扩展名 ''''------------------------------------------------------------------------------------ Public Function GetExtName(ByVal strFileName As String) As String Return Right(strFileName, InStr(StrReverse(strFileName), ".")) End Function End Class
上一页 [1] [2] [C语言系列]NET 中C#的switch语句的语法 [系统软件]托拽Explore中的文件到VB.net的窗口 [系统软件]Boost库在XP+Visual C++.net中的安装 [常用软件]新配色面板:Paint.Net3.0RC1官方下载 [常用软件]用内建的“Net Meeting”聊天 [VB.NET程序]Henry的VB.NET之旅(三)—共享成员 [VB.NET程序]Henry的VB.NET之旅(二)—构造与析构 [VB.NET程序]Henry的VB.NET之旅(一)—失踪的窗体 [VB.NET程序]在托盘上显示Balloon Tooltip(VB.NET) [VB.NET程序]Henry手记-VB.NET中动态加载Treeview节点(二)
|