Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Uploading file for CDO.Message

    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.

    Code:
    <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 ...

    Code:
    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

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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.

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •