Attachments

Discussion in 'ASP .Net' started by STEPHEN ANDRADE, Sep 21, 2007.

  1. I am currently designing a webform for sending email. I want to send an
    attachment with the email. I am using the html Input File to pick the
    location of the file I want to attach.

    I find that there is no problem sending an attachment when there are no
    spaces in the directory (e.g. c:\images\new.jpg) but if the path specified
    has spaces (c:\documents and settings\my documents\new.jpg) then I am
    getting http exception I have tried using different character instead of the
    spaces

    If uploadedfile.Value <> "" Then

    Dim substring As String

    substring = uploadedfile.Value.ToString 'uplodedfile = htmlinputfile

    Dim Attach As MailAttachment = New MailAttachment(substring)

    Message.Attachments.Add(Attach)

    Response.Write(uploadedfile.Value)

    End If

    If you have any suggestions I wouuld love to hear them

    Thanks in advance
    Stephen
    STEPHEN ANDRADE, Sep 21, 2007
    #1
    1. Advertising

  2. STEPHEN ANDRADE

    bruce barker Guest

    the htmlinputfile is the location on the client machine, not the server.
    you should write the uploaded file to disk, then use that file as an
    attachment.

    -- bruce (sqkwork.com)

    STEPHEN ANDRADE wrote:
    > I am currently designing a webform for sending email. I want to send an
    > attachment with the email. I am using the html Input File to pick the
    > location of the file I want to attach.
    >
    > I find that there is no problem sending an attachment when there are no
    > spaces in the directory (e.g. c:\images\new.jpg) but if the path specified
    > has spaces (c:\documents and settings\my documents\new.jpg) then I am
    > getting http exception I have tried using different character instead of the
    > spaces
    >
    > If uploadedfile.Value <> "" Then
    >
    > Dim substring As String
    >
    > substring = uploadedfile.Value.ToString 'uplodedfile = htmlinputfile
    >
    > Dim Attach As MailAttachment = New MailAttachment(substring)
    >
    > Message.Attachments.Add(Attach)
    >
    > Response.Write(uploadedfile.Value)
    >
    > End If
    >
    > If you have any suggestions I wouuld love to hear them
    >
    > Thanks in advance
    > Stephen
    >
    >
    >
    >
    bruce barker, Sep 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ajit
    Replies:
    0
    Views:
    383
  2. Aleksei Pashin

    Send email message with attachments

    Aleksei Pashin, Oct 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    438
    Aleksei Pashin
    Oct 12, 2004
  3. Satish Appasani

    Search attachments stored in SQL Server

    Satish Appasani, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    887
    Satish Appasani
    Jun 26, 2003
  4. codewarrior
    Replies:
    0
    Views:
    518
    codewarrior
    May 4, 2009
  5. Peter Green
    Replies:
    0
    Views:
    629
    Peter Green
    Nov 5, 2009
Loading...

Share This Page