473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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. I´ve
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 2938
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. I´ve
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. I´ve
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ruben Duarte | last post by:
Hi, Anybody knows if is posible in Linux with PHP to do upload of several files sending the data before that php script executes. Now in my server you do the upload (with html,form, multipart...
2
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none...
4
by: Evgeny Zoldin | last post by:
Hi ALL. I would like to download file from some web-server that requires Basic-Authetication, change somthing in the file and upload it back to the server. I can download the file and proceed...
1
by: Sam | last post by:
Hi, I want to be able to send an email w/ attachment. I have an INPUT Type="File" HTMLControl on the page. User selects the attachment using this control. That's where I'm stuck. First, I...
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
10
by: Aj Blosser | last post by:
Hey guys, I have a question for you, I have a setup where I'm sending files through the POST to a php web page, I read the file contents, put that file contents as text into the POST string, and...
4
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of...
0
by: SSG | last post by:
Dear All, Pls see the bw form in html. <FORM id=FORM1 name=FORM1 action=Upload.asp method=post encType=multipart/form-data> File 1:<INPUT type=file name=FILE1> Description 1:<INPUT...
5
by: kamlesh20J | last post by:
Hello, I am trying to use HttpWebRequest to send some POST data I have accomplished this using: HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://mysite.com/index.php");...
1
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.