zoukankan      html  css  js  c++  java
  • C# 批量上传

    前台

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>批量上传组件</title>
    <link href="css/upload.css" rel="stylesheet" type="text/css" />
    <script src="js/mootools.js" type="text/javascript"></script>
    <script src="js/Swiff.Uploader.js" type="text/javascript"></script>
    <script src="js/Fx.ProgressBar.js" type="text/javascript"></script>
    <script src="js/FancyUpload2.js" type="text/javascript"></script>
    <script src="js/UploadScript.js" type="text/javascript"></script>
    </head>
    <body>
    <form action="upload.aspx?id=<%=Guid.NewGuid().ToString() %>" method="post" enctype="multipart/form-data" id="form-demo">
    <div class="clearfix" style=" 811px; margin: 5% auto; overflow: hidden; height: 207px; display: block;">
    <fieldset id="demo-fallback" style="display: none;">
    <legend>文件上传</legend>
    <label for="demo-photoupload">
    <input type="file" name="Filedata" />
    </label>
    </fieldset>
    <div id="demo-status" class="hide">
    <p>
    <b id="demo-browse2" style="position: absolute;  80px; height: 26px;"></b><a href="javascript:;" id="demo-browse">
    <img src="images/brow_file.png" /></a> | <a href="javascript:;" id="demo-clear">
    <img src="images/file_del.png" /></a> | <a href="javascript:;" id="demo-upload">
    <img src="images/upload_ico.png" /></a>
    </p>
    <div>
    <strong class="overall-title"></strong>
    <br />
    <img src="images/progress-bar/bar.gif" class="progress overall-progress" />
    </div>
    <div>
    <strong class="current-title"></strong>
    <br />
    <img src="images/progress-bar/bar.gif" class="progress current-progress" />
    </div>
    <div class="current-text"></div>
    </div>
    <ul id="demo-list"></ul>
    </div>
    </form>
    </body>
    </html>
    <script type="text/javascript">
    //js脚本出错的时候,不要给出任何提示。IE中如果js脚本运行错误,右下角会出现小的叹号。
    //加上这句,就不会出现任何提示了。
    window.onerror = new Function("return true;");
    </script>
    

      

    后台:

    //获取文件
    HttpPostedFile httpFile = Request.Files["FileData"];
    if (httpFile != null)
    {
    //获取文件名字
    string fileName = httpFile.FileName;
    //保存文件的路径
    string uploadPath = Server.MapPath("temp\") + fileName;
    //保存文件
    httpFile.SaveAs(uploadPath);
    Response.Write("文件: " + uploadPath + " 上传成功!"); 
    }
    

      

  • 相关阅读:
    shiro 权限集成Ehcache 配置 学习记录(二)
    shiro 集成spring 配置 学习记录(一)
    无网线的情况下,虚拟机和主机通信
    activeMQ集群搭建及高可用
    spring集成activeMQ
    ActiveMQ的两种消息模式,主题、队列
    Weblogic10.3.6部署解决CXF webService 调用报错: “Cannot create a secure XMLInputFactory”
    静态代理和动态代理对比
    Java中的静态代理实现方式
    PHP求解一个值是否为质数
  • 原文地址:https://www.cnblogs.com/qukaicheng/p/7390988.html
Copyright © 2011-2022 走看看