Using PHPmailer to gather information and a document to be mailed to my own account. Cannot get the upload correct. The infomation I can find is cofusing.
The form upload is the usual:
The form handler is
Obviously something is missing.
I have been playing with this but
1) It forwards the file from an upload directory. How is the file directed to /uploads ?
2) this is written for an image file. I expect various document formats.
3) I added
$dir = "uploads/$filename";
(/uploads/ is already set to full permissions, so the chmod() function, which creates an error string anyway, is unnecessary). This creates an error message. /uploads is in the document directory.
4) Does the uploaded document have to placed in an array?
What I would really like to do is rename the uploaded document to $first.$last.$title with some string manipulation, but $POST_['resume'] creates the error
The form upload is the usual:
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Upload resume</td>
<td style="width: 1184px">
<input name="resume" type="file" size="45" /></td>
</td></tr>
The form handler is
<DOCTYPE HTML PUBLIC
"-//W3C//DDT HTML 4.01 Transitional//EN"
"
<html>
<head>
<title>Contact and sign up</title>
<link rel="stylesheet" type="text/css" href="phpmailerform.css">
</head>
<body>
<div class="style7"><h3><p>To register with us please fill out the following fields and upload a resume.</P>
<p>The files marked with * are required. The rest will make it easier for us to pick your resume. To be placed on our newsletter and job alert list, click the button at the end</p></h3></div>
<form action="process_form.php" method="POST" enctype='multipart/form-data'>
<table style="width: 792px; height: 553px" cellspacing="5" class="style4">
<tr>
<td style="width: 1085px" class="style2" valign="top">Last Name</td>
<td style="width: 1184px">
<input name="last_name" type="text" size="50" ></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">First</td>
<td style="width: 1184px">
<input name="first" type="text" size="50" ></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">EMail</td>
<td style="width: 1184px">
<input name="email" type="text" size="50" ></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Cell Phone </td>
<td style="width: 1184px">
<input name="cell" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Phone</td>
<td style="width: 1184px">
<input name="phone" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">City</td>
<td style="width: 1184px">
<input name="city" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">State</td>
<td style="width: 1184px">
<input name="state" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Zip</td>
<td style="width: 1184px">
<input name="zip" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Current
position/title</td>
<td style="width: 1184px">
<input name="position" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Current
Current or last position at</td>
<td style="width: 1184px">
<input name="location" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px; " class="style2" valign="top">
Employer type (restaurant, hotel, Club, etc)</td>
<td style="width: 1184px">
<input name="type" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Desired
location</td>
<td style="width: 1184px">
<input name="Text16" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Training or
education</td>
<td style="width: 1184px">
<input name="training" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px; height: 40px;" class="style2" valign="top">Special skills(Asian, comfort, etc)</td>
<td style="width: 1184px; height: 40px;">
<input name="skills" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">
Culinary Style</td>
<td style="width: 1184px">
<input name="styles" type="text" size="50" /></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">
Comments</td>
<td style="width: 1184px">
<textarea name="comments" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td style="width: 1085px" class="style2" valign="top">Upload resume</td>
<td style="width: 1184px">
<input name="resume" type="file" size="45" /></td>
</td></tr>
</table>
<?php
require_once('recaptchalib.php');
$publickey = "6LcVxwcAAAAAAIgVQ17ZYXbikv6VBpEEmTztdqYA"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
// <p><input type="submit" value="send" /p><br/>
</form>
</body>
</html>
Obviously something is missing.
I have been playing with this but
1) It forwards the file from an upload directory. How is the file directed to /uploads ?
2) this is written for an image file. I expect various document formats.
3) I added
$dir = "uploads/$filename";
(/uploads/ is already set to full permissions, so the chmod() function, which creates an error string anyway, is unnecessary). This creates an error message. /uploads is in the document directory.
4) Does the uploaded document have to placed in an array?
What I would really like to do is rename the uploaded document to $first.$last.$title with some string manipulation, but $POST_['resume'] creates the error
Notice: Undefined index: resume in /home/jll/public_html/process_form.php on line 68
Message has been sent.