这个估计不行,你还不如当你提交的时候处理,做个判断:
<%
set file=upload.file("photo")
fileExt=lcase(right(file.filename,4))
if fileEXT<>".gif" and fileEXT<>".jpg" then
response.write"<script>alert('文件格式不对,请重新上传!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
%>