【问题标题】:asp.net multiple file upload controlasp.net多文件上传控制
【发布时间】:2012-11-20 19:51:18
【问题描述】:

我在模态弹出窗口上有两个 FileUpload 控件。第一个文件上传控件工作正常,将文件保存到服务器。但是,第二个文件上传控件与第一个完全相同,但是当它上传文件时,它被上传为损坏的 0 字节。任何想法可能会发生什么?此外,我的更新面板上有一个触发器,它解决了在更新面板中设置上传控件的问题。

我的asp和c#都很简单

<tr align="center">
 <td>Editable Doc</td>
  <td>
     <asp:FileUpload ID="uploadeditable" runat="server" />
  </td>
</tr>

下面是代码

 upload.PostedFile.SaveAs(path + "\\" + file);

【问题讨论】:

  • 两个控件是否有相同的 ID ?
  • upload 指的是什么?

标签: c# asp.net


【解决方案1】:

与 UpdatePanel 控件不兼容的控件

以下 ASP.NET 控件与部分页面更新不兼容,因此在 UpdatePanel 控件中不受支持:

1. TreeView and Menu controls.

2. Web Parts controls. For more information, see ASP.NET Web Parts Controls.

3. FileUpload controls when they are used to upload files as part of an asynchronous postback.

4. GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false.

5. Login, PasswordRecovery, ChangePassword, and CreateUserWizard controls whose contents have not been converted to editable templates.

6. The Substitution control.

7. Validation controls, which includes the BaseCompareValidator, BaseValidator, CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, and ValidationSummary control.

对于您的类型信息,请检查 FileUpload1.hasfile 它在​​更新面板中使用时将始终返回 false。

【讨论】:

    猜你喜欢
    • 2011-11-22
    • 1970-01-01
    • 2011-10-12
    • 1970-01-01
    • 2015-02-26
    • 1970-01-01
    • 2016-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多