PDA

View Full Version : Form file to mail


Werner
02-15-2007, 12:49 PM
I am fairly new in the whole webdesinging world. I would like to know how to design a form that you can attach a file to via a browse button and when the submit button is clicked it will be emaild.

I know that you must use "file" as the type for the text box and it places a browse button automaticly but im batling to get the server side script right. please please assist me. :confused: :confused:

Regards and thanx
werner

davidj
02-15-2007, 02:14 PM
what are you writing this in

Werner
02-15-2007, 02:24 PM
I have set up a cgi script for now to just send me an email of the text fields and not the file attachment.
I basically just point it to the .txt file where that contains my email address and the general layout of the e-mail: See example:



To: email@domain.com
Subject: Public Comment Submission
A Public Comment have been submitted from the Website.
Name: [Name]
Email: [email]
Comment:[comment]


and in the htmal file this is how my form looks like:


<form action="/cgi-sys/cgiemail/feedback.txt" method="post">
<td width="188" height="161" background="images/left_top.gif" valign="top">
<div style="margin-left: 10px; padding-top: 10px;"><br>
<span class="left">Quick Comments:</span><span class="left">
<textarea name="comment" cols="15" id="comment"></textarea>
<br>
<input name="submitquickcomment" type="submit" id="submitquickcomment" value="Submit">
<input type ="hidden" name="success" value="http://www.domain.com/feedback.html">
</span><span class="left">
<input type="reset" name="Submit2" value="Reset">
</span></div>
<p class="left"><br>
<br>
<br>
</p> </td>
</form>

feedback.html is just a "thank you for submitting" page.

This sends me an email but now i would like to add a text field with type:"file"

I would like to stick with cgi as i got this working.
Is it more difficult in cgi? Should i go with php?

Thank you for your response
Werner

Werner
02-15-2007, 02:27 PM
Sorry the text example should be:

To: email@domain.com
Subject: Feedback from website

A feedback have been submitted from the Website.
Comment:[comment]

davidj
02-15-2007, 02:29 PM
if you can i would use PHP as this has more to offer although both would do the trick i would imagine that cgi would be a bit more tricky than PHP

We have a PHP mail script tutorial on the front page

http://www.dreamweaverclub.com/dreamweaver-php-form.php

start by getting that working how you want it then we can move onto attachments

if you want to take up PHP then why not give the tutorials a bash

http://www.dreamweaverclub.com/vtm

Werner
02-15-2007, 02:32 PM
i really appreciate your help. It seems like a simple question but i really just need to attach a file and e-mail it. i shall look at your links and get it working.

Thank you
Werner