zoukankan      html  css  js  c++  java
  • HttpFileCollection 类使用

    public ActionResult GetForm()
            {
                HttpRequest request = System.Web.HttpContext.Current.Request;
                HttpFileCollection FileCollect = request.Files;  
                if (FileCollect.Count > 0)          //如果集合的数量大于0
                {
                    foreach (string str in FileCollect)
                    {
                        HttpPostedFile FileSave = FileCollect[str];  //用key获取单个文件对象HttpPostedFile
                        string imgName = DateTime.Now.ToString("yyyyMMddhhmmss");
                        string imgPath = "/" + imgName + FileSave.FileName;     //通过此对象获取文件名
                        string AbsolutePath = Server.MapPath(imgPath);
                        FileSave.SaveAs(AbsolutePath);              //将上传的东西保存
                        Response.Write("<img src='" + imgPath + "'/>");
                    }
                }
                return Content("键值对数目:" + FileCollect.Count);
            }
  • 相关阅读:
    中国用户mac上快速安装nodejs
    移动前端的开发痛点
    前端模块化思考
    tcpdump学习
    curl 同时发送多个请求
    apache 做http代理
    文件 FIFO队列
    mysql多表字段名重复的情况
    时间戳实现增量数据同步
    python 学习
  • 原文地址:https://www.cnblogs.com/dullbaby/p/3795222.html
Copyright © 2011-2022 走看看