Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

attaching a file

Status
Not open for further replies.

mwebbo1

Technical User
Jul 11, 2002
71
US
ok...here is the form that I am using.
-------------->
<FORM ACTION=&quot;saveinfo.asp&quot; METHOD=&quot;post&quot; name=&quot;form1&quot;>
<table border=&quot;0&quot; width=&quot;100%&quot; bgcolor=&quot;#FFFFFF&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;>
<tr>
<td width=&quot;200&quot; align=&quot;right&quot; valign=&quot;top&quot;><h5>Name</h5></td>
<td> <input type=&quot;text&quot; maxlength=&quot;20&quot; size=&quot;47&quot; class=&quot;form_field&quot; name=&quot;Name&quot;></td>
</tr>
<tr>
<td align=&quot;right&quot; valign=&quot;top&quot;><h4>Address</h4></td>
<td><input type=&quot;text&quot; maxlength=&quot;20&quot; size=&quot;35&quot; class=&quot;form_field&quot; name=&quot;Name2&quot;></td>
</tr>
<tr>
<td align=&quot;right&quot; valign=&quot;top&quot;><h4>City</h4></td>
<td align=&quot;left&quot; valign=&quot;top&quot;><input name=&quot;city&quot; type=&quot;text&quot; class=&quot;form_field&quot; id=&quot;city2&quot; size=&quot;25&quot; maxlength=&quot;20&quot;></td>
</tr>
<tr>
<td align=&quot;right&quot; valign=&quot;top&quot;><h4>State</h4></td>
<td align=&quot;left&quot; valign=&quot;top&quot;><input name=&quot;State&quot; type=&quot;text&quot; class=&quot;form_field&quot; id=&quot;State4&quot; size=&quot;4&quot; maxlength=&quot;20&quot;></td>
</tr>
<tr>
<td align=&quot;right&quot; valign=&quot;top&quot;><h4>zip</h4></td>
<td align=&quot;left&quot; valign=&quot;top&quot;><input name=&quot;zip&quot; type=&quot;text&quot; class=&quot;form_field&quot; id=&quot;zip&quot; size=&quot;12&quot; maxlength=&quot;20&quot;>
</td>
</tr>
<tr>
<td width=&quot;200&quot; align=&quot;right&quot; valign=&quot;top&quot;><h5>Email</h5></td>
<td> <input type=&quot;text&quot; maxlength=&quot;30&quot; size=&quot;35&quot; class=&quot;form_field&quot; name=&quot;email&quot;></td>
</tr>
<tr>
<td width=&quot;200&quot; align=&quot;right&quot; valign=&quot;top&quot;><h4>Phone (w/ area code)</h4></td>
<td> <input type=&quot;text&quot; maxlength=&quot;20&quot; size=&quot;12&quot; class=&quot;form_field&quot; name=&quot;phone&quot;></td>
</tr>
<tr>
<td width=&quot;200&quot; align=&quot;right&quot; valign=&quot;top&quot;><h4>Comments/ Requests</h4></td>
<td><textarea name=&quot;comment&quot; cols=&quot;34&quot; rows=&quot;4&quot; class=&quot;form_field&quot;></textarea></td>
</tr>
<tr>
<td width=&quot;200&quot; align=&quot;right&quot; valign=&quot;top&quot;></td>
<td><a href=&quot;javascript:document.form1.submit()&quot;>Submit</a>&nbsp;&nbsp;<a href=&quot;javascript:document.form1.reset()&quot;>Resets</a></td>
</tr>
</table>
</form>
----------->
and then it is linked to the file saveinfo.asp
----------->
<%
Option Explicit

Dim objNewMail

' First create an instance of NewMail Object
Set objNewMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

' setting up the email

objNewMail.From = request(&quot;email&quot;)
objNewMail.To = &quot;me.me@verizon.net&quot;

objNewMail.Subject = &quot;Site Visitor Information&quot;

Dim e
Dim strBody
For Each e in Request.Form
strBody = strBody & e & &quot; = &quot; & Request(e) & chr(10)

Next
objNewMail.Body = strBody


objNewMail.Send

' After the Send method, NewMail Object become Invalid

Set objNewMail = Nothing

'Response.Write &quot;Email has been sent&quot;
Response.Redirect(&quot;index.asp&quot;)


%>
--------------------->

how would I add the option for someone to attach a file from their computer? Possible?
Thanks!!!
 
You add a file upload input like this:

<input type=&quot;file&quot; name=&quot;FileUp&quot;>

you have to set the form Enctype to:
enctype=&quot;multipart/form-data&quot;

Here is a link to a page that has a great script for accepting the upload:

I think there is also an FAQ written on the subject in the VBscript forum.

Hope it helps.



Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top