<?php
mysql_connect("localhost","root","") or die("cannot connect to the database server");
mysql_select_db("stressert") or die ("cannot select database");
?>
<?php
//include("config.php");
?>
<?php
$vcode=$_POST['vcode'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$email=$_POST['email'];
$mobile=$_POST['mobile'];
$phone=$_POST['phone'];
$address=$_POST['address'];
$address2=$_POST['address2'];
$city=$_POST['city'];
$state=$_POST['state'];
$city=$_POST['city'];
$zip=$_POST['zip'];
$country=$_POST['country'];
$countryborn=$_POST['countryborn'];
$stateoforigin=$_POST['stateoforigin'];
$dob=$_POST['dob'];
$sex=$_POST['sex'];
$empstatus=$_POST['empstatus'];
$currsalary=$_POST['currsalary'];
$skills=$_POST['skills'];
$cv=$_POST['cv'];
//variables access
$cv_route = $_FILES['cv']['name'];
$today =date("y-m-d" );
//upload image and check for image type
//make sure to change your path to match your images directory
$cvDir ="c:/wamp/www/Stresserts/cv/";
$cvname = $cvDir . $cv_route;
if (move_uploaded_file($_FILES['cv']['tmp_name'],$cvname))
{
//get info about the image being uploaded
list( $type) = getimagesize($cvname);
switch ($type) {
case 1:
$ext = ".pdf";
break;
case 2:
$ext = ".doc";
break;
default:
//echo "Sorry, but the file you uploaded was not a doc, pdf file.
";
//echo "Please hit your browser's 'back' button and try again.";
}
$query="INSERT INTO applicant(vcode,fname,lname,email,mobile,phone,address,address2,city,state,zip,country,countryborn,stateoforigin,dob,sex, empstatus, currsalary, skills, cv) VALUES ('$vcode','$fname','$lname','$email','$mobile','$phone','$address','$address2','$city','$state', '$zip','$country','$countryborn','$stateoforigin','$dob','$sex','$empstatus', '$currsalary', '$skills', '$cv')";
mysql_query($query) or die(mysql_error());
echo "submitted";
}
?>
Above here is my process code and below is my form
value="">
<td align="left">Upload Cv</td>
<td align="left"><input name="cv" type="file" id="cv">
<input type='hidden' name='cv' value="<?php echo @($_POST['cv'])?>">
Acceptable formats include: .doc and .pdf.
|
You can please check and see if you can help (I had to reduce the content due to space constraint, other fields in the form re submitting except the file upload that was why it is the only one i copied out here.