1

我有一个 ASP.NET 4.0 Web 应用程序,用户可以在其中将视频上传到服务器。我有一个FileUpload控件和 2DropDownList秒。

FileUpload用户首先从控件中选择要上传的视频,然后从DropDownList1(类别列表)中选择类别。用户选择一个类别后,我用子类别填充第二个DropDownList类别。

当我选择要上传的文件并从 中选择一个类别时DropDownList,页面在回发后与服务器断开连接。如果我在选择要上传的文件的情况下执行相同的场景,我会成功填充第二个组合。

这是我的代码:

 <tr>
        <td style="text-align: left;" class="style9" colspan="2">
            <asp:Label ID="Label1" runat="server" Text="Video" Width="80px"></asp:Label>
            <asp:FileUpload ID="FileUploadVideo" runat="server" ViewStateMode="Enabled" />
        </td>
        <td style="text-align: left;" class="style4">
            <asp:Label ID="Label3" runat="server" Text="Category" Width="80px"></asp:Label>
            <br />
            <asp:DropDownList ID="cmbCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbCategory_SelectedIndexChanged">
            </asp:DropDownList>
        </td>
        <td style="text-align: right;">
            <asp:Label ID="Label6" runat="server" Text="Subcategory" Width="80px"></asp:Label>
            <br />
            <asp:DropDownList ID="cmbSubcategory" runat="server">
            </asp:DropDownList>
        </td>
    </tr>

任何帮助,将不胜感激。

4

1 回答 1

2

由于您正在上传视频,我想这是由于文件大小而出错。ASP.NET 应用程序的默认最大文件大小为 4MB。<system.web>您可以在 web.config 的部分中添加类似的内容以增加默认值:

<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>

例如,这允许上传一个 20MB 的文件。

有关更多信息,请查看这篇文章:ASP.NET 中的大文件上传

于 2012-04-11T12:49:55.630 回答