How can I add file attachment to my form and get the attachment by email?

I'm using this code and it works fine, but I don't get the attachment file in the email. How can I add this to my code?
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">// <![CDATA[
              $(document).ready(function() {
                $("#form1").validate({
                  rules: {
                    first: "required",// simple rule, converted to {required:true}
                    email: {// compound rule
                    required: true,
                    email: true
                  last: {
                    last: true
                  comment: {
                    required: true
                  messages: {
                    comment: "Please enter a comment."
// ]]></script>
<script type="text/javascript">// <![CDATA[
function validate ()
          if (document.form1.first.value == "")
          alert("Please enter your First Name");
          document.form1.first.focus();
          document.form1.first.style.border="1px solid red";
          return false;
          else if (document.form1.last.value == "")
          alert("Please enter your Last Name");
          document.form1.last.focus();
          document.form1.last.style.border="1px solid red";
          return false;
          else if (document.form1.emailaddress.value == "")
          alert("Please enter your Email Address");
          document.form1.emailaddress.focus();
          document.form1.emailaddress.style.border="1px solid red";
          return false;
function has_focus() {
    if(document.form1.first.value == "")
                              document.form1.first.focus();
                              document.form1.style.first.border="1px solid green";
function set_focus(x)
          document.getElementById(x).style.border="1px solid #80CA75";
function clear_focus(x)
          document.getElementById(x).style.border="1px solid #DBDFE6";
// ]]></script>
</head>
<body>
<p><span style="color: #666666; text-align: center; font-size: 13px;">Please complete this form if you have any technical issue.</span></p>
<form id="form1" action="http://www.southsun.com/php/tech_issue.php" enctype="multipart/form-data" method="post">
<table style="width: 850px; font-size: 15px; padding-left: 20px; text-align: center;" border="0">
<tbody>
<tr>
<td style="text-align: left; padding-bottom: 20px;" colspan="2">
<h2><span style="color: #666666;">Please complete this form if you have any technical issue.</span></h2>
</td>
</tr>
<tr style="padding-top: 40px;">
<td style="text-align: left;"><span style="color: #abaf6f;"><strong>First Name</strong>:*</span><input id="first1" name="first" type="text" />  <br /><br /> <span style="color: #abaf6f;"><strong>Last Name</strong>:*</span><input id="last1" name="last" type="text" /><br /><br /> <span style="color: #abaf6f; padding-right: 33px;"><strong>Email</strong>:</span><span style="color: #abaf6f;">*</span><input id="email1" name="email" type="text" /><br /><br /> <span style="color: #abaf6f;"><strong>Shipping Method:</strong><br /></span> <input name="shippingmethod" type="radio" value="prioritymail" /> Priority Mail                                                                 <input name="shippingmethod" type="radio" value="store" /> In Store Pick up <br /> <input name="shippingmethod" type="radio" value="ground" />  Ground                                                                       <input name="shippingmethod" type="radio" value="3day" /> 3 Day Select<br /><br /> <span style="color: #abaf6f;"><strong>Payment Method:</strong><br /></span> <input name="paymentmethod" type="radio" value="paypal" /> Paypal Method                                                       <input name="paymentmethod" type="radio" value="creditcard" /> Credit Card<br /> <strong><br /> <span style="color: #abaf6f;">If getting an error message, please explain the error:</span></strong><span style="color: #abaf6f;"> <br /></span> <textarea id="errormessage" cols="20" rows="2" name="errormessage"></textarea><br /><br /></td>
<td style="border-left: 1px solid grey; padding-left: 40px; text-align: left;"><span style="color: #abaf6f;"><strong>If using Paypal, Were you redirected successfully?</strong><br /></span> <input name="paypalredirect" type="radio" value="yes" /> Yes                                                                 <input name="paypalredirect" type="radio" value="no" /> No<br /><br /> <span style="color: #abaf6f;"><strong>If using Credit Card, Did you get an error?</strong><br /></span> <input name="carderror" type="radio" value="yes" /> Yes                                                                  <input name="carderror" type="radio" value="no" /> No<br /><br /> <span style="color: #abaf6f;"><strong>What happened after clicking place order? </strong><br /></span> <textarea id="placeorder1" cols="20" rows="2" name="placeorder"></textarea><br /><br /> <span style="color: #abaf6f;"><strong>Comments</strong>: <br /></span> <textarea id="comments1" cols="20" rows="2" name="strcomments"></textarea><br /><br /> <span style="color: #abaf6f;"><strong>Attach PrintScreen</strong>: <br /></span> <input name="strresume" type="file" />
<div style="height: 50px;"> </div>
</td>
</tr>
<tr>
<td style="padding-top: 20px;" colspan="2">( * ) indicates required fields</td>
</tr>
<tr>
<td style="text-align: center; padding-top: 20px;" colspan="2"><input class="button" name="submit" type="submit" value="Submit" />                        <input class="button" name="reset" type="reset" value="Reset" /></td>
</tr>
</tbody>
</table>
</form>
</body></html>
PHP
<?php
echo $savestring;
//--------------------------paramaters--------------------------
// Subject of email sent to you.
$subject = 'prueba con uploads';
// Your email address. This is where the form information will be sent.
$emailadd = '[email protected]';
// Where to redirect after form is processed.
$url = 'http://www.pch-graphicdesign.com';
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';
$target_path = "http://www.pch-graphicdesign.com/php/uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$text = "Results from form:\n\n";
$space = ' ';
$line = '
foreach ($_POST as $key => $value)
if ($req == '1')
if ($value == '')
{echo "$key is empty";die;}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

Sending a file as an attachment to an email involves setting the correct MIME type and headers. There's a brief tutorial here: http://webcheatsheet.com/php/send_email_text_html_attachment.php.
Also, you need to use the same name as in your form. In the script you have shown here, the name of the file field is strresume, but your processing script uses this: $_FILES['uploadedfile']['name']. It should be this: $_FILES['strresume']['name']

Similar Messages

  • Im switching email accounts on my itunes account am the computer isnt recognizing purchases made from my other account on the new one (apps). How can I sign in with my new account and get the purchases apps on both accounts?

    Im switching email accounts on my itunes account am the computer isnt recognizing purchases made from my other account on the new one (apps). How can I sign in with my new account and get the purchases apps on both accounts?

    This was EXACTLY what I needed about the purchases I made from my device. However, is there a way to re-download other ones you've made from a computer? Because I realized some of them were not just purchased from my device.
    This is a picture of what it looks like now:
    http://tinypic.com/r/107quxu/7
    As you can see, the stuff circled in red doesn't give me an option to download from Cloud Beta because it already says "downloaded".
    any way to get around that?

  • How can I convert files in Aperture to jpegs and keep the file large

    I want to upload files into istock photo and they must be as big as possible but in jpg format. I end up exporting tiny little things going from 8mb to 300kb. How can I do it? I even tried going into CS3 but that only allowed me to convert to tif. I would appreciate any help - especially if it is simple!

    Go to File >> Export >> Export Version(s)
    In the resulting dialog box you'll find a drop down called Export Preset with a list of presets. One of them is JPEG Original Size. That should do it for you.
    Also you can choose Edit at the bottom of the preset list and modify an existing preset or create a new custom preset.
    BTW: the reason you couldn't do it in Photoshop is that you need to convert it from 16bit to 8bit before you can save a JPEG. That command in Photoshop is under Image>>Mode.
    DLS

  • How can I add a new message(custom text message) to the holiday approval em

    How can I add a new message(custom text message) to the holiday approval email-notification sent to the manager?
    TIA

    The answer is 'not very easily', unless the information you want to display is the employee's leave balances. In 12.1.3 Oracle have delivered functionality that allows you to include the leave balances in the approval notifications out-the-box, ie, without customization.
    For any other information you're probably going to have to customize the standard delivered HRSSA workflow. Within this workflow, the Leave of Absence functionality uses the Notify Approver (Embedded) (HR_APPROVER_NTF) notification. The body of this notification is set to the Notify Approver (Embedded) (HR_NTF_EMBEDDED_REGION) attribute. This in turn defaults to:
    JSP:/OA_HTML/OA.jsp?OAFunc=-&HR_EMBEDDED_REGION-&NtfId=-&#NID-
    So essentially you can change the HR_APPROVER_NTF notification. The problem with changing this notification is that it's generic - it's used for all SSHR functions and not just Leave of Absence. That means you have to make other, more substantial, customizations to the workflow to ensure the changes you make only applies to LOA.
    The other option is to personalize the review page (ie, the region referenced in &HR_EMBEDDED_REGION) to include whatever messages you want. But that means they'll appear on the Review page and all LOA approval notifications and that might not be what you want.
    It's usually better to live with what Oracle deliver and find an alternative solution! What's the content of the message you want to include?

  • How can I add a field to a Repeating Frame in the body of a 9i Report

    How can I add a field to a Repeating Frame in the body of an Oracle 9i Report whose source is in a higher group?
    I want to change an Oracle 9i report. The report has no header or trailer but only a body. The body has the parent frame fields & a repeating frame with four fields, A, B, C & D. They all seem to be in one group. I want to add another field E to the repeating frame whose source is from the 'header'.
    I added the field & created a boiler plate & then added the new field, E to the original group A, B, C & D. In the Property Inspector for the field, I pointed the source to the source column in the main query. However, when I run the report, I receive the error "Invalid body size". Some notes on Metalink indicate that this could be due to margins being out of the printable area.
    Moreover, after making the changes & after having unsuccessfully run the report, when I try to open the Page Layout for the report, I get no details.
    Thanks,

    Hi,
    i also got same query can u pls tell me elaborately, if u can can u pls send some code.
    Thanks & Regards
    Jagadeeshwar.B

  • How can i add rows in a tabular form

    Hi,
    How can i add rows in a tabular form with out updating in database and after adding the rows one by one and after filling the data then iwant to submit them all at once.Please help me on this.
    Thanks

    Hello Leandro,
    In the Add_Rows page process, there is a box for "Number Of Rows". Change that value and you change the number of rows that get added. The default is 1.
    Don.
    You can reward this reply by marking it as either Helpful or Correct :)

  • How can I attach multiple filled-form PDFs to the same outgoing email on iPhone/iPad?

    How can I attach multiple filled-form PDFs to the same outgoing email on iPhone/ iPad?

    This isn't supported in the current version of Adobe Reader on iPhone/iPad.
    Shradha

  • After creating a new playlist in iTunes, how can I add my entire music library --at once-- to the new playlist. I want to download all my music from Icloud at once on my Macpro

    After creating a new playlist in iTunes, how can I add my entire music library --at once-- to the new playlist. I want to download all my music from Icloud at once on my Macpro

    You have two separate questions here...
    To get all your music into one playlist, select Music in the sidebar and click the Songs view at the top. Then, highlight all the songs and drag them into your playlist.
    I don't know if it's possible to download all Purchased content (or do you mean iTunes Match content?) at once; try a few Google searches.

  • How can I add a language on pages (Greek) to check the spelling when that language is not on the list?

    how can I add a language on pages (Greek) to check the spelling when that language is not on the list?
    I can see other languages available for spelling check, but not Greek and I dont see how to add it.
    I have added the Greek keyboard on the Mac, so I can write in Greek , but I dont know how to check the spelling in Greek on pages

    You can try to add a 3rd party spellchecker
    http://milaraki.com/blog/2010/11/greek-spelling-at-pages-how-to/

  • How can I add a person to an event (and send that person an invite) without resending the meeting invitation to all participants?

    How can I add a person to an event (and send that person an invite) without resending the meeting invitation to all participants?

    Apple doesn't make it easy to do what you want.  However, here's how I do it. 
    Select the photo you want to move and create a new Event for it via the Event ➙ Create Event menu option.
    In the Event mode select the new Event with the one picture and drag it onto the Event you want to move the photo to.

  • How can I add members to a role by script in the tabular model?

    How can I add members to a role by script in the tabular model?  I have the role set up, and I have a security table created that contains the domain/userid of all of the users that I'd like to add to that role.  Can this be done by script rather
    than manually?  

    <Name>ReadAllRole</Name>
    <Members>
    <Member>
    <Name>xxxxxxx\xxxxx</Name>
    <Sid>x-x-x-xx-xxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxxx</Sid>
    </Member>
    </Members>
    Where would I find the Sid to add the members? 

  • How can I use apple mail (linked to gmail) and get it to only do autofill on the contacts that I have in apple address book?

    How can I use apple mail (linked to gmail) and get it to only do autofill on the contacts that I have in apple address book? Everytime I write an email on the Apple mail app (as well as in Gmail) it recommends a bunch of emails that are not my contacts. I want it to just autofill for the contacts that I have in my address book. Is this possible? Thank you. I have an Imac Intel version and an Iphone 5 phone.

    Mail > Window > Previous Recipients

  • I have a 2008 macbook and i lost the start up disk and forgot the password. how can i put it back to factory mode and change the password

    i have a 2008 macbook and i lost the start up disk and forgot the password. how can i put it back to factory mode and change the password

    Check out this article http://gigaom.com/apple/reset-os-x-password-without-an-os-x-cd/

  • I live in Germany at the moment. How can I buy iPad mini with retina online and  get tax free?

    I live in Germany at the moment. How can I buy iPad mini with retina online and  get tax free?

    Do you qualify for a tax free purchase?  The online stores will collect the required taxes for their country and region.  I know in the USA, if you are a tax free corporation, and you purchase it directly with a corporate account, you can get an item tax free using the company account and the corporations registered tax exempt number.  But an individual citizen cannot avoid paying the appropriate required taxes when shopping the online Apple web store.

  • My computer where my itunes library is stored is no longer accessible.  how can i add songs to my ipod nano without losing the songs already on it.

    The computer where i have my itunes library is no longer accessible.  How can I add new songs to my  Ipod nano without losing the song already on it?

    You will need that library copied from the old computer. If not, then you can take a look at this in getting 3rd party software to recover your library from the iPod. Syncing to a "New" Computer or replacing a "crashed" Hard Drive

Maybe you are looking for

  • Best ways to create rpd or reports if we have data in more fact tables

    I have fact and dimensional data in one or more different tables. Then each logical table source represents one data segment.Please suggest me some methods or ways like fragmentation through which i can use them in creating rpd and report and main pr

  • How to add data in a table UI from  two different NODE

    Hello Experts, We have a requirement to show data in a table which is coming from different node. Suppose the table has 10 column ( among them 5 are coming from node A and others are coming from node B) I tried to add node A as a source of the table,

  • XML page cannot be displayed - Servlet error

    Hi, I am trying to extract XML data from a source using a servlet.But i am getting this error when i run my servlet in IE : The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refr

  • Adobe 9 attaching pdf to email locks computer

    When I try to attach a pdf to an email using adobe 9, it locks up my computer.  I have at least ten end users that are experiencing the same problem.  This is an intermittant problem, sometimes it attaches and emails fine, other times it locks up the

  • Relation between Prod. Hierarchy and Profit Centre

    Dearest all, does anybody know what the relation between prod. hierarchies and profit centre? actually, i am trying to display total of actual line items (table GPCPT, if i am not wrong). The total value grouped by Profit Centre? But I want to displa