1
1
1
0
Your image has been saved
test1 = "image.jpg"
test2 = "image.gif"
test3 = "image.png"
test4 = "image.txt"
response.write testFileType(test1)&"
"
response.write testFileType(test2)&"
"
response.write testFileType(test3)&"
"
response.write testFileType(test4)&"
"
if testFileType(test1) = 1 then
response.write "Your image has been saved"
else
response.write "This image is the wrong file type"
end if
function testFileType(FileName)
AllowedTypes = " jpg gif png "
FileType=right(FileName,3)
if instr(AllowedTypes,FileType) > 0 Then
testFileType = 1
else
testFileType = 0
end if
' http://www.w3schools.com/asp/func_instr.asp
end function