简体   繁体   中英

asp.net multiple file upload control

I have two FileUpload controls on a modal popup. The first fileupload control works fine saving the file to the server. However, the second fileupload control is exactly the same as the first but when it uploads the file it is uploaded as corrupted with 0 bytes. Any ideas what could be happening? Also I have a trigger on my updatepanel that fixes the issue with having an upload control inside of an updatepanel.

My asp and c# are pretty simple

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

here is the code behind

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

Controls that Are Not Compatible with UpdatePanel Controls

The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control:

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.

For your kind info check FileUpload1.hasfile it will always return false while using in updatepanel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM