...

View Full Version : Uploading file for CDO.Message



WilliamHolmes
06-19-2007, 07:04 PM
Hi im using the CDO.Message server object and im trying to upload a file to send via email (CDO).

I know there is something wrong with this as it doesnt attach the file.

Can anyone help ?? Here is the code.

Thanks.



<form name="messageform" id="messageform" action="send-email.asp"method="post">
<INPUT TYPE=FILE NAME="FILE1" class="fileButton">
<input name="sndmsg" id="sndmsg" type="submit">
</form>


and ...




Set myMail=CreateObject("CDO.Message")
myMail.Subject="Subject"
myMail.From="test@mydomain.com"
myMail.To="test@mydomain.com"
myMail.AddAttachment ""&request.Form("FILE1")
myMail.HTMLBody="<html><body>Test</body></html>"
myMail.Send
set myMail=nothing

miranda
06-19-2007, 11:41 PM
ASP has no built in upload component. You will need to have either a 3rd party component or use a pure asp solution to upload your files.

In either case you will not have access to Request.Form. Most will use Upload.Form instead. Also on the page that does the uploading make sure that you include the enctype="multipart/form-data" attribute in your form's tag.

WilliamHolmes
06-20-2007, 02:13 AM
excellent.
What i can do so is...
1) upload the file to a directory.
2) Take in the form details using upload.form
3) Send the message
4) Delete the uploaded file
5) Finally re-direct

Thanks now i have a clearer understanding of it all



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum