 
        
界面如上图,点浏览获取文件么,单击上传,调试代码时发现,在判断FileUpload是否有文件的时候,竟然是false,获取不到文件。。。请高手指教。。。。

body>
    <sunuc:Loading id="Loading1" runat="server"></sunuc:Loading>
    <form id="form1" onkeydown="return ConvertKeyCode();" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
                <cc:ToolBar ID="ExtToolbar1" runat="Server" AutoPostBack="True">
                </cc:ToolBar>
                <cc:ToolBar ID="ExtToolbar2" runat="Server" AutoPostBack="True">
                </cc:ToolBar>
                <cc:ToolBar ID="WorkflowToolbar" runat="Server" AutoPostBack="true">
                </cc:ToolBar>
                <asp:UpdatePanel ID="UpdatePanelAttachment" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <cc:ToolBar ID="AttachmentToolBar" runat="Server" AutoPostBack="true">
                </cc:ToolBar>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="AttachmentToolBar" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:UpdatePanel ID="UpdatePanelForm" runat="server">
            <ContentTemplate>
                <cc:ExtPanel ID="ExtPanel1" runat="server">
                <table id="table1" width="100%">
                            <!--1-->
                            <tr>
                                <!--会议主题-->
                                <td style="width: 15%">
                                    <cc:ExtLabel ID="lblMeetingTopic" runat="server" Required="false"></cc:ExtLabel>
                                </td>
                                <td style="width: 35%">
                                <cc:ExtDropDownList ID="ddlMeetingTopic" Width="300" runat="server" Required="false" RequiredHintId="" ></cc:ExtDropDownList>
                               <%-- <cc:ExtTextBox ID="etxtMeetingTopic" Width="300"  runat="server" Enabled="false" ReadOnly="true"></cc:ExtTextBox>--%>
                                <asp:Image ID="imgMeetingTopic" SkinID="edit" runat="server"/>
                                </td>
                                <!--开始日期-->
                                    <td style="width: 15%">
                                        <cc:ExtLabel ID="lblStartDate" runat="server" Required="false"></cc:ExtLabel>
                                    </td>
                                    <td style="width: 35%">
                                        <cc:ExtDateField ID="ttbStartDate" runat="server" Width="160" Required="false" RequiredHintId="" ></cc:ExtDateField>
                                    </td>
                            </tr>
                            <!--2-->
                            <tr><!--文件标题-->
                                <td style="width: 15%">
                                    <cc:ExtLabel ID="lblFileTitle" runat="server" Required="false"></cc:ExtLabel>
                                </td>
                                <td style="width: 35%">
                                    <cc:ExtTextBox ID="ttbFileTitle" Width="292"  runat="server" Required="false" RequiredHintId="" ></cc:ExtTextBox>
                                </td>
                                    <!--结束日期-->
                                    <td style="width: 15%">
                                        <cc:ExtLabel ID="lblEndDate" runat="server" Required="false"></cc:ExtLabel>
                                    </td>
                                    <td style="width: 35%">
                                        <cc:ExtDateField ID="ttbEndDate" runat="server" Width="160" Required="false" RequiredHintId="" ></cc:ExtDateField>
                                    </td>
                            </tr>
                            <!--3-->
                            <tr>
                                <!--文件描述-->
                                <td style="width: 15%">
                                    <cc:ExtLabel ID="lblFileDescription" runat="server" Required="false"></cc:ExtLabel>
                                </td>
                                <td style="width: 35%">
                                <cc:ExtTextBox ID="ttbFileDescription" Width="292"  runat="server" Required="false" RequiredHintId="" ></cc:ExtTextBox>
                                </td>
                                <!--相关链接-->
                                    <td style="width: 15%">
                                        <cc:ExtLabel ID="lblFileLink" runat="server" Required="false"></cc:ExtLabel>
                                    </td>
                                    <td style="width: 35%">
                                        <cc:ExtTextBox ID="ttbFileLink" runat="server" Required="false" RequiredHintId="" ></cc:ExtTextBox>
                                    </td>
                            </tr>
                            <!--4-->
                            <tr>
                                <!--文件名称-->
                                <td style="width: 15%">
                                    <cc:ExtLabel ID="lblFileName" runat="server" Required="false"></cc:ExtLabel>
                                </td>
                                <td style="width: 35%">
                                   <%-- <cc:ExtTextBox ID="ttbFileName" runat="server" Required="false" RequiredHintId="" ></cc:ExtTextBox>--%>
                                    <asp:FileUpload runat="server" Width="300" ID="UploadFile" Height="24" BackColor="White" />
上传文件的默认大小是4M,检查一下其他的原因。
首先看一下FileUpload(<input type="file">)是否在表单里面(form)。必须在form里面
表单的请求方式(method)是get还是post。必须是post
我发了代码,你帮看下。。谢谢
上传的文件有没有超过200kb?
谢谢回答,没有超过,但我想不应该是这个问题啊,hasFile获取不到文件,FileName也获取不到文件名。
原来是UpdatePanel不支持上传。。