Last week I showed you how to get the size of a file. This week I'm going to show you how to get the type of a file. This is useful if you want to display an icon or bit of text next to a hyperlink to indicate the file type. Some people like to use this to warn visitors when they link to a PDF file, because PDF readers can take a while to load.
ASP
function getFileType(someFile)
dim fs
set fs = Server.CreateObject("Scripting.FileSystemObject")
getFileType = fs.GetExtensionName(Server.MapPath(someFile))
set fs = nothing
end function
See you next week!
No comments:
Post a Comment