1
Reply

How to access file uplod cntrl in any other class

M CH

M CH

Oct 24 2017 2:29 PM
164
(ASP.NET C# Language) 
Hi guys, I have just one Default.aspx page in web application where I have file upload control (fileUpload1) and 2nd I have class1.cs I want to access fileUpload1 control in my class1.cs. How is it possible. MoreOver, I want this type code in my class1.cs
 
MailMessage msg = new MailMessage(YourEmail, RecipientEmail, Subj, Message);
msg.Attachments.Add(new Attachment(fileUpload1.PostedFile.InputStream, fileUpload1.FileName);
 
 
Please help me.  Thanks a lot.

Answers (1)