I am doing new version of old form and everything has worked great but I have problems with the old FileUpload tag. I am using jQuery Multiple File Upload Plugin as new upload style and it works great! Only problem is that if I delete old FileUpload element the new one doesn't work anymore. So my goal is to make form where user can choose files which will sent as attachment of an email. I have spent hours trying to figure out how this is even possible because I have deleted all references to this element from the c# file also. Does anybody have ideas?
<!-- PROBLEM STARTS-->
<!-- if I delete or add Visible="false" attribute to the element the new upload system wont work anymore-->
<asp:FileUpload ID="fuIssueAttachmentUppload" runat="server" Width="218px" EnableViewState="False"
ViewStateMode="Disabled" />
<!-- PROBLEM ENDS-->
<p>
<asp:Label ID="lblIssueAttachment" runat="server" Text="Attach file(s)"></asp:Label><br />
<input type="file" class="multi" />
</p>
<asp:Button ID="btnSend" runat="server" Text="Send" OnClick="btnSend_Click" Width="290px"
CausesValidation="False" />
This is the part where I attach the uploaded files to the email
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFile file = Request.Files[i];
mail.Attachments.Add(new Attachment(file.InputStream, file.FileName));
}
I managed to fix it! The new input tag didn't have runat-attribute. So only thing I had to do is to remove the old tag and modify new upload tag to this:
<input runat="server" type="file" class="multi" />