"Gaby" <GabrielESandoval@gmail.com> wrote in message
news:1150492278.725596.187030@r2g2000cwb.googlegro ups.com...[color=blue]
> 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 = "mymail@school.edu"
> 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[/color]
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.