, if you do not install the AspJpeg components please download here. Http://down.111cn.net/down/soft/object/2009/0227/35.html
Function chkimg (IMG)
On error Resume Next ' in order to capture error messages, the code needs to be able to continue executing when an error occurs
Dim Retunvalue, Chkjpeg
Retunvalue = True
' If the path is empty, the picture is considered illegal
If isnull (img) Then chkimg = False:exit Function
Set chkjpeg = Server.CreateObject ("Persits.jpeg")
If-2147221005 <> Err Then ' If the component is supported, check the legality of the picture with the component
Chkjpeg.open Server.MapPath (IMG)
If ERR Then
Retunvalue = False
End If
Else ' If the component is not supported, skip direct return True
Retunvalue = True
End If
' The necessary clean-up work
If err.number <> 0 Then Err.Clear
Set Chkjpeg = Nothing
Chkimg = Retunvalue
End Function