
protected readonly static List<string> VALID_FILE_TYPES = new List<string> { "pdf", "PDF" }; |
protected bool ValidateFileType(string fileName) |
{ |
string fileType = String.Empty; |
int lastDotIndex = fileName.LastIndexOf("."); |
if (lastDotIndex >= 0) |
{ |
fileType = fileName.Substring(lastDotIndex + 1).ToLower(); |
} |
if (VALID_FILE_TYPES.Contains(fileType)) |
{ |
PageClass.PDFFileType = fileType; |
return true; |
} |
else |
{ |
return false; |
} |
} |




by: 发表于:2017-12-18 09:40:02 顶(0) | 踩(0) 回复
??
回复评论