asp.net多文件上传控件

时间:2012-11-20 19:51:18

标签: c# asp.net

我在模态弹出窗口中有两个FileUpload控件。第一个fileupload控件可以很好地将文件保存到服务器。但是,第二个文件上载控件与第一个完全相同,但是当它上传文件时,它被上传为损坏的0字节。有什么想法会发生什么?此外,我的updatepanel上还有一个触发器,修复了在更新面板内部设置上传控件的问题。

我的asp和c#非常简单

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

这是背后的代码

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

1 个答案:

答案 0 :(得分:0)

与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,在updatepanel中使用时它将始终返回false。