0

我在monoX CMS中工作并尝试上传文件。但是文件上传的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>

我的 HTML 代码是:

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

在萤火虫中看到的表单标签是:

<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">
4

0 回答 0