判断文件名是否合法

asp函数

2008-05-24 08:59

判断文件名是否合法
Function isFilename(aFilename)
Dim sErrorStr,iNameLength,i
isFilename=TRUE
sErrorStr=Array("/","\",":","*","?","""","<",">","|")
iNameLength=Len(aFilename)
If iNameLength<1 Or iNameLength=null Then
   isFilename=FALSE
Else
   For i=0 To 8
    If instr(aFilename,sErrorStr(i)) Then
     isFilename=FALSE    
    End If
   Next
End If
End Function