469,330 Members | 1,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

send file (upload) - asp

Hello all.
Hope anyone can help me!
I have this form, with:
Please choose your file: (browse)

The main purpose is the user to select a local file and then when he submits
a mail should be sent with that doc as attachment!
When the user submits i have a new asp from where the mail is sent. Ive
defined all the propertys (like subject, from, to...) ok! (i use cdo.message
to send the mail)
My question is: how can i send as attachment the document the user submited?
Thank you for your time!
Regards.
Apr 19 '06 #1
2 2755
May want to use the .NET built in Mail

Sorry C# if you use VB.neT, below is VS.NET 2005 FW 2.0 and below it 1.1
This is incomplet but should get an idea.
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();

System.Net.Mail.Attachment ma = new
System.Net.Mail.Attachment("AttachmentFileName"); // if you saved it to HD

or

System.Net.Mail.Attachment ma2 = new
System.Net.Mail.Attachment("System.IO.Stream"); // if getting it directly
from memory

byte[] uploadedFile;

Request.Files[0].InputStream.Read(uploadedFile,0,Request.Files[0].ContentLength);

System.Net.Mail.SmtpClient sc = new System.Net.Mail.SmtpClient("host");

or

System.Net.Mail.SmtpClient sc2 = new System.Net.Mail.SmtpClient("host",
"port");

// Set up From, To, Subject, Body, Encoding etc.. etc... etc... then Send
Message

sc.Send(mm);

// Depricated this is the old way of doing it. VS.NET 2003 FW 1.1

System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage();

System.Web.Mail.SmtpMail = "smtpmail";

System.Web.Mail.MailAttachment ma = new
System.Web.Mail.MailAttachment("AttachmentFileName ");

mm.Attachments.Add(ma);

System.Web.Mail.SmtpMail.Send(mmx);

SA

"Cimento Cola" <ci*********@sexmagnet.com> wrote in message
news:u$**************@TK2MSFTNGP04.phx.gbl...
Hello all.
Hope anyone can help me!
I have this form, with:
Please choose your file: (browse)

The main purpose is the user to select a local file and then when he
submits a mail should be sent with that doc as attachment!
When the user submits i have a new asp from where the mail is sent. Ive
defined all the propertys (like subject, from, to...) ok! (i use
cdo.message to send the mail)
My question is: how can i send as attachment the document the user
submited?
Thank you for your time!
Regards.

Apr 19 '06 #2
Sorry I did not see ASP and not ASP.NET.

SA
"MSDN" <sq**********@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
May want to use the .NET built in Mail

Sorry C# if you use VB.neT, below is VS.NET 2005 FW 2.0 and below it 1.1
This is incomplet but should get an idea.
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();

System.Net.Mail.Attachment ma = new
System.Net.Mail.Attachment("AttachmentFileName"); // if you saved it to HD

or

System.Net.Mail.Attachment ma2 = new
System.Net.Mail.Attachment("System.IO.Stream"); // if getting it directly
from memory

byte[] uploadedFile;

Request.Files[0].InputStream.Read(uploadedFile,0,Request.Files[0].ContentLength);

System.Net.Mail.SmtpClient sc = new System.Net.Mail.SmtpClient("host");

or

System.Net.Mail.SmtpClient sc2 = new System.Net.Mail.SmtpClient("host",
"port");

// Set up From, To, Subject, Body, Encoding etc.. etc... etc... then Send
Message

sc.Send(mm);

// Depricated this is the old way of doing it. VS.NET 2003 FW 1.1

System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage();

System.Web.Mail.SmtpMail = "smtpmail";

System.Web.Mail.MailAttachment ma = new
System.Web.Mail.MailAttachment("AttachmentFileName ");

mm.Attachments.Add(ma);

System.Web.Mail.SmtpMail.Send(mmx);

SA

"Cimento Cola" <ci*********@sexmagnet.com> wrote in message
news:u$**************@TK2MSFTNGP04.phx.gbl...
Hello all.
Hope anyone can help me!
I have this form, with:
Please choose your file: (browse)

The main purpose is the user to select a local file and then when he
submits a mail should be sent with that doc as attachment!
When the user submits i have a new asp from where the mail is sent. Ive
defined all the propertys (like subject, from, to...) ok! (i use
cdo.message to send the mail)
My question is: how can i send as attachment the document the user
submited?
Thank you for your time!
Regards.


Apr 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ruben Duarte | last post: by
2 posts views Thread by Fatih BOY | last post: by
4 posts views Thread by Evgeny Zoldin | last post: by
1 post views Thread by Sam | last post: by
9 posts views Thread by eswanson | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.