email form w/ attachments error

Discussion in 'ASP General' started by Gaby, Jun 16, 2006.

  1. Gaby

    Gaby Guest

    I made this form with a very basic code

    <HTML>
    <HEAD>
    <TITLE>Submit Papers</TITLE>
    </HEAD>
    <BODY>
    <%
    If Len(Request.Form("txtEmail")) > 0 then

    Dim objMail
    Set objMail = Server.CreateObject("CDONTS.NewMail")

    objMail.From = Request.Form("txtEmail")
    objMail.Subject = "Email attachment demo"
    objMail.AttachFile Server.MapPath(Request.Form("attachment"))
    objMail.To = ""
    objMail.Body = "the following papers have been submitted."
    objMail.Send

    Response.write("<i>EMail was Sent</i><p>")

    'You should always do this with CDONTS.
    set objMail = nothing


    End If
    %>

    <form method="post" id=form1 name=form1>
    <b>Enter your email address:</b><br>
    <input type="text" name="txtEmail"
    value="<%=Request.Form("txtEmail")%>">

    <input type=file name="attachment" runat=server
    value="<%Request.Form("attachment")%>">
    <p>
    <input type="submit" value="Submit!" id=submit1 name=submit1>
    </form>

    </BODY>
    </HTML>


    ---

    i tried it and got this error:

    Server.MapPath() error 'ASP 0172 : 80004005'

    Invalid Path

    /web/test/email/demo2.asp, line 14

    The Path parameter for the MapPath method must be a virtual path. A
    physical path was used.


    ---
    is there something i should change to make sure i get what they
    selected as an atachment.

    thanks again,
    gabriel
     
    Gaby, Jun 16, 2006
    #1
    1. Advertising

  2. Gaby

    Ron Hinds Guest

    "Gaby" <> wrote in message
    news:...
    > I made this form with a very basic code
    >
    > <HTML>
    > <HEAD>
    > <TITLE>Submit Papers</TITLE>
    > </HEAD>
    > <BODY>
    > <%
    > If Len(Request.Form("txtEmail")) > 0 then
    >
    > Dim objMail
    > Set objMail = Server.CreateObject("CDONTS.NewMail")
    >
    > objMail.From = Request.Form("txtEmail")
    > objMail.Subject = "Email attachment demo"
    > objMail.AttachFile Server.MapPath(Request.Form("attachment"))
    > objMail.To = ""
    > objMail.Body = "the following papers have been submitted."
    > objMail.Send
    >
    > Response.write("<i>EMail was Sent</i><p>")
    >
    > 'You should always do this with CDONTS.
    > set objMail = nothing
    >
    >
    > End If
    > %>
    >
    > <form method="post" id=form1 name=form1>
    > <b>Enter your email address:</b><br>
    > <input type="text" name="txtEmail"
    > value="<%=Request.Form("txtEmail")%>">
    >
    > <input type=file name="attachment" runat=server
    > value="<%Request.Form("attachment")%>">
    > <p>
    > <input type="submit" value="Submit!" id=submit1 name=submit1>
    > </form>
    >
    > </BODY>
    > </HTML>
    >
    >
    > ---
    >
    > i tried it and got this error:
    >
    > Server.MapPath() error 'ASP 0172 : 80004005'
    >
    > Invalid Path
    >
    > /web/test/email/demo2.asp, line 14
    >
    > The Path parameter for the MapPath method must be a virtual path. A
    > physical path was used.
    >
    >
    > ---
    > is there something i should change to make sure i get what they
    > selected as an atachment.
    >
    > thanks again,
    > gabriel


    The INPUT type=file gives a browse button for the Client to search for files
    located on *their* machine. Server.MapPath, on the other hand, is used to
    map a virtual path (e.g. /uploads/filename.ext) to a physical path *on the
    server*, NOT on the client! What you need is a way to upload the client's
    file to your webserver, in, for instance, an "uploads" virtual folder on
    your webserver. Although there is a "Posting Acceptor" ASP sample script
    from Microsoft, I've never seen it work. You need a third-party file
    uploader like SoftArtisans SAFileUp - http://www.softartisans.com.
     
    Ron Hinds, Jun 16, 2006
    #2
    1. Advertising

  3. Gaby

    Gaby Guest

    that stinks. i was under the impression i could get it to work without
    a third-party fileuploader.
    i guess ill try something completely different.

    thanks.
    gabriel

    Ron Hinds> The INPUT type=file gives a browse button for the Client to
    search for files
    > located on *their* machine. Server.MapPath, on the other hand, is used to
    > map a virtual path (e.g. /uploads/filename.ext) to a physical path *on the
    > server*, NOT on the client! What you need is a way to upload the client's
    > file to your webserver, in, for instance, an "uploads" virtual folder on
    > your webserver. Although there is a "Posting Acceptor" ASP sample script
    > from Microsoft, I've never seen it work. You need a third-party file
    > uploader like SoftArtisans SAFileUp - http://www.softartisans.com.
     
    Gaby, Jun 16, 2006
    #3
  4. On 16 Jun 2006 15:29:59 -0700, "Gaby" <>
    wrote:
    in <>

    >that stinks. i was under the impression i could get it to work without
    >a third-party fileuploader.
    >i guess ill try something completely different.
    >
    >thanks.
    >gabriel
    >
    >Ron Hinds> The INPUT type=file gives a browse button for the Client to
    >search for files
    >> located on *their* machine. Server.MapPath, on the other hand, is used to
    >> map a virtual path (e.g. /uploads/filename.ext) to a physical path *on the
    >> server*, NOT on the client! What you need is a way to upload the client's
    >> file to your webserver, in, for instance, an "uploads" virtual folder on
    >> your webserver. Although there is a "Posting Acceptor" ASP sample script
    >> from Microsoft, I've never seen it work. You need a third-party file
    >> uploader like SoftArtisans SAFileUp - http://www.softartisans.com.


    If you have an app installed on their computer you can use the FTP API
    to upload files.

    ---
    Stefan Berglund
     
    Stefan Berglund, Jun 17, 2006
    #4
  5. Gaby

    MikeR Guest

    Gaby wrote:
    > that stinks. i was under the impression i could get it to work without
    > a third-party fileuploader.
    > i guess ill try something completely different.

    My ISP provides an upload component. Check with yours.
    Mike
     
    MikeR, Jun 17, 2006
    #5
  6. Gaby

    surf_doggie Guest

    surf_doggie, Jun 18, 2006
    #6
    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. Aleksei Pashin

    Send email message with attachments

    Aleksei Pashin, Oct 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    452
    Aleksei Pashin
    Oct 12, 2004
  2. Replies:
    2
    Views:
    1,119
    Mike Meyer
    Jun 22, 2005
  3. budyerr
    Replies:
    7
    Views:
    327
    Misbah Arefin
    Feb 19, 2008
  4. codewarrior
    Replies:
    0
    Views:
    535
    codewarrior
    May 4, 2009
  5. Peter Green
    Replies:
    0
    Views:
    642
    Peter Green
    Nov 5, 2009
Loading...

Share This Page