首页 > Web开发 > 详细

html 上传文件

时间:2015-10-20 16:32:20      阅读:280      评论:0      收藏:0      [点我收藏+]

1.html代码

  <form id="form1" action="TestYield" method="post" enctype="multipart/form-data">
    <div>
    
         <input type="text"  id="title" name="title"/>
        <input type="file"  id="file" name="file"/>

        <input type="submit"  value="提交" />
    </div>
    </form>

 2.后台接收代码

 

   HttpFileCollection hfc = Context.Request.Files;

            if (Request["title"] != null)
            {
                Response.Write(Request["title"]);
            }
            if (hfc.Count>0)
            {
                HttpPostedFile hf = Context.Request.Files["file"];

                Response.Write(hf.FileName);
            }
            else
            {
                Response.Write("is null");
            }
            return;

 

html 上传文件

原文:http://www.cnblogs.com/tiancai/p/4895192.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!