6 Answers, 1 is accepted
0
Hello Brent,
I'm afraid this is out of the scope of the RadUpload control. I'd suggest you make a search on Google for possible solutions.
Best wishes,
Paul
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I'm afraid this is out of the scope of the RadUpload control. I'd suggest you make a search on Google for possible solutions.
Best wishes,
Paul
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brent
Top achievements
Rank 1
answered on 09 Feb 2009, 01:18 PM
OohKaay. . .
So it works like a regular asp:FileUpload control then? I guess that was what I was getting at.
0
Myriam
Top achievements
Rank 1
answered on 19 Mar 2009, 01:11 PM
So it is not possible to do that?
0
_Haakon_
Top achievements
Rank 1
answered on 09 Feb 2010, 01:23 AM
foreach (EmailAttachment attach in attachments) |
{ |
Attachment attachFile = new Attachment(attachmentsPath + attach.fileName); |
mail.Attachments.Add(attachFile); |
} |
//Here is the EmailAttacment class I used: |
public class EmailAttachment |
{ |
public string fileName { get; set; } |
public string filePath { get; set; } |
public string attachmentURI { get; set; } |
public int fileSize { get; set; } |
public EmailAttachment() |
{ |
} |
} |
//Here is the code I used upon submission of the form to load the generic list: |
List<EmailAttachment> attachments = new List<EmailAttachment>(); |
for (int i = 0; i < ruAttachments.UploadedFiles.Count; i++) |
{ |
EmailAttachment attachment = new EmailAttachment(); |
attachment.filePath = attachmentsPath + ruAttachments.UploadedFiles[i].GetName(); |
attachment.fileName = ruAttachments.UploadedFiles[i].GetName(); |
attachments.Add(attachment); |
} |
You can use the RadUpload tool to get the file names and then have them uploaded to a folder called "attachments". Then create a simple class called EmailAttachments and have it get - set a filename string. Then upon submission of your email form grab the file names from the RadUpload tool and store them in a generic list of EmailAttachment objects. Pass that to your email class and then add this code to add them to your email:
0
Mike
Top achievements
Rank 1
answered on 03 Feb 2011, 04:05 PM
Thanks for posting these tips and code. I found that its also possible to take an in-memory file and pass that to the MailMessage without having to first save to disk (by using the UploadedFile.InputStream property):
aspx:
C# code-behind:
aspx:
<
telerik:RadUpload
ID
=
"RadUpload1"
InitialFileInputsCount
=
"1"
MaxFileInputsCount
=
"1"
ControlObjectsVisibility
=
"None"
runat
=
"server"
>
</
telerik:RadUpload
>
C# code-behind:
UploadedFile file = RadUpload1.UploadedFiles[0];
Attachment attachment = new Attachment(file.InputStream, file.FileName);
MailMessage message = new MailMessage();
message.Attachments.Add(attachment);
0
$uren
Top achievements
Rank 1
answered on 20 Feb 2012, 11:40 AM
Hello mike ..!
Could you just send me the full code because an too working on same issue.
Thanks & Regards,
Suren
Could you just send me the full code because an too working on same issue.
Thanks & Regards,
Suren