zoukankan      html  css  js  c++  java
  • ASP实现多图片上传(一)

    关于多图片上传一直是一个让人头疼的话题,我看过了不少的文章和代码。现在我写的这篇文章是把我比较喜欢的一篇代码和动网里的高手对这篇代码优化后再加上我增加一些代码结合出来的!呵呵,其实这篇文章是沾了写这篇代码的人(稻香居士)和动网里那些高手的光。:)
    好了,不说废话了。开始来搭建所需要的环境和数据结构!
    先新建一个名字叫photo的文件夹。(我在这里就是把图片上传到这个文件夹里的。)建立一个名字叫database的数据库。再接着建立一个名字叫sFile的表。表里设计四个字段分别是id(int),image(varchar),image1(varchar),image2(varchar)。我这里用的数据库是SQL。
    相关的文件
    register.asp
    <html>
    <head>
    <title>文件</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <form name="form1" method="post" action="save.asp">
      <table width="50%" border="1" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td width="20%"><a href="#"  OnClick="javascript:window.open(’/reg_upload.asp’,null,’    left=40%,top=40%,height=250,width=470,status=yes,toolbar=no,menubar=no,resizable=yes,copyhistory=yes,scrollbars=yes,location=no,status=no,titlebar=no’)">图片上传</a></td>
          <td width="80%">   
            <input type="text" name="myface">
              
            <input type="text" name="myface1">
              
            <input type="text" name="myface2">
            (此处用户不必填图片上传后自动生成) </td>
        </tr>
        <tr> 
          <td colspan="2"  align="center"> 
            <input type="submit" name="Submit" value="提交">
            <input type="reset" name="Submit2" value="重设">
          </td>
        </tr>
      </table>
    </form>
    </body>
    </html>

    reg_upload.asp
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type"  content="text/html; charset=gb2312">
    <link rel="stylesheet" href="css/style.css" type="text/css">
    </head>
    <body leftmargin="0" topmargin="0"   >
      <br>
    <br>
    <br>
    <table width="90%" border="0" align="center" bgcolor="#000000" height="152" cellspacing="1">
      <tr> 
        <td height="34" align="center" bgcolor="#FFFFFF"><font color="#FFFF33"><b><font size="4" color="#000000">选择图片</font></b></font></td>
     
    </tr>
      <tr> 
        <td bgcolor="#FFFFFF"> 
          <form name="form"  method="post" action="upfile.asp" enctype="multipart/form-data" >
            <input type="hidden" name="filepath" value="photo">
            <input type="hidden"  name="act" value="upload">
            <input type="file" name="file1"  size="30"><br>
             <input type="file" name="file2" size="30"><br>
             <input type="file" name="file3" size="30">
               
            <input  type="submit" name="Submit" value="粘 贴" class="tl">
          </form>
        </td>
      </tr>
    </table>
    </body>
    </html>
    本文来源于 WEB开发网 原文链接:http://www.cncms.com.cn/asp/5006_2.htm

  • 相关阅读:
    MyBatis入门(一)—— 入门案例
    Spring Boot统一异常处理方案示例
    Centos7 安装 ActiveMq
    在 CentOS7 上安装 zookeeper-3.5.2 服务
    使用Homebrew安装Git与Github在idea中的配置
    iReport(模版) 与Jasper(数据填充)生成pdf文档
    SSH下shiro的基本使用
    FastJson的忽略字段和格式日期用法
    Quartz —— 任务调度框架
    POI操作Excel
  • 原文地址:https://www.cnblogs.com/kuyuecs/p/1294584.html
Copyright © 2011-2022 走看看