zoukankan      html  css  js  c++  java
  • HttpContext.Current.Request.Files后台取不到值的解决方法 [转]

    上传文件的东东, 前台是3个INPUT:

    <INPUT   style= "WIDTH:   480px;   HEIGHT:   22px "   type= "file "   name= "File "   size= "60 ">
    <INPUT   style= "WIDTH:   480px;   HEIGHT:   22px "   type= "file "   name= "File "   size= "60 ">
    <INPUT   style= "WIDTH:   480px;   HEIGHT:   22px "   type= "file "   name= "File "   size= "60 ">

    在后台遍历    

     HttpFileCollection    files      =    HttpContext.Current.Request.Files;

                             int    mm    =    files.Count;

    结果: mm    =0;

        可能有几种原因,针对这些原因有如下方法:

    一、form    的enctype不对. 要加入enctype= "multipart/form-data "

    二、手工加这个或者至少放一个runat= 'server '的file控件在窗体中.

    三、form中用了AJAX,如果没有必要用,就不要随处放updatePannel控件

  • 相关阅读:
    [JSOI2016]最佳团体
    CF125E MST Company
    CF482C Game with Strings
    CF379F New Year Tree
    CF1051F The Shortest Statement
    小a和uim之大逃离
    新魔法药水
    翻硬币
    [CQOI2017]小Q的棋盘
    UVA11729突击战
  • 原文地址:https://www.cnblogs.com/wukong0214/p/2918588.html
Copyright © 2011-2022 走看看