文件上载在Asp.net中不起作用。HasFile始终为false

文件上载在Asp.net中不起作用。HasFile始终为false,asp.net,file-upload,Asp.net,File Upload,我在MonoxCMS工作,试图上传文件。但文件上传的hasFile总是错误的。我在.aspx页面使用服务器脚本。下面是我的代码 <script runat="server"> protected void btn_click_me(object sender, EventArgs e) { dbOperations dbObj = new dbOperations(); if (selected_file.HasFile)

我在MonoxCMS工作,试图上传文件。但文件上传的hasFile总是错误的。我在.aspx页面使用服务器脚本。下面是我的代码

     <script runat="server">
     protected void btn_click_me(object sender, EventArgs e)
     {
        dbOperations dbObj = new dbOperations();
        if (selected_file.HasFile)
        {
            string title = txt_file_title.Value.ToString();
            int f_type = Convert.ToInt32(dd_file_type.Value);

            dbObj.CreateSubmission(title, f_type, selected_file.PostedFile);
        }
    }
    </script>

受保护的无效btn\u单击\u me(对象发送者,事件参数e)
{
dbOperations dbObj=新的dbOperations();
如果(选定的文件.HasFile)
{
字符串title=txt_file_title.Value.ToString();
int f_type=Convert.ToInt32(dd_file_type.Value);
创建提交(标题、f_类型、选定的_文件.PostedFile);
}
}
我的Html代码是:

  <MonoX:StyledButton ID="btnSubmit" CommandName="submit" OnClick="btn_click_me" runat="server" CausesValidation="true" ValidationGroup="validate_submission" Text='Submit'>
  </MonoX:StyledButton>

firebug中看到的表单标签是:

<form id="aspnetForm" enctype="multipart/form-data" style="height: 100%" onsubmit="javascript:return WebForm_OnSubmit();" action="/MyFolder/Submissions.aspx" method="post" name="aspnetForm">

渲染文件标记为:

<input type="file" id="ctl00_ctl00_ctl01_ctl00_cp_cp_cp_cp_selected_file" name="ctl00$ctl00$ctl01$ctl00$cp$cp$cp$cp$selected_file">


请发布渲染的
元素。我已经添加了渲染表单。我还需要您发布渲染的HTML文件元素。我还添加了渲染文件元素。