• λ我爱Aspx >> Asp.Net >> 图片上传中,文件的校验
  • 图片上传中,文件的校验

  • :未知  Դ:internet  :2007-5-5 19:44:27  ؼ:
  • 图片上传中,文件的校验

    来源:奥索网

    图片上传中,文件的校验

    作者:tonglw

    这是我的一点心得,希望能对大家有所帮助。有不足之处请大家包涵,多多指教。

    客户端校验

    <html>

    <head>

    <meta http-equiv="Content-Language" content="zh-cn">

    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">

    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">

    <meta name="ProgId" content="FrontPage.Editor.Document">

    <title>选择图片</title>

    <SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>

    <!--

    Sub button1_onclick

    if trim(window.form1.file1.value)="" then

    alert "选择图片!"

    exit sub

    end if

    sfile=trim(window.form1.file1.value)

    sfile=ucase(right(sfile,4))

    if sfile=".JPG" or sfile=".GIF" then

    window.form1.submit

    else

    alert "选择 *.JPG 或 *.GIF 文件!"

    exit sub

    end if

    End Sub

    Sub file1_onfocus

    sfile=window.form1.file1.value

    sfile=ucase(right(sfile,4))

    if sfile=".JPG" or sfile=".GIF" then

    window.form1.photo.style.visibility="visible"

    window.form1.photo.src =window.form1.file1.value

    end if

    End Sub

    -->

    </SCRIPT>

    </head>

    <body style="font-size: 9pt">

    <p align="center">选择图片</p>

    <FORM action="add.php" method=POST method=post enctype="multipart/form-data" id=form1 name=form1>

    Ҷƪл˵?
  • һƪ用户认证及管理(完全版)
    һƪ用纯ASP代码实现图片上传并存入数据库中