<?php include("includes/config.php"); 
//This is the directory where images will be saved
   	$name=time();
    $target = "cv/";
    $target = $target .$name. basename( $_FILES['cv']['name']);
//This gets all the other information from the form
		$name = $_REQUEST['name'];
		$phone = $_REQUEST['phone'];
		$email = $_REQUEST['email'];
		$address = $_REQUEST['address'];
		$education = $_REQUEST['education'];
		$cv=($_FILES['cv']['name']);
//Writes the photo to the server
$uploadOk = 1;
$imageFileType = pathinfo($target,PATHINFO_EXTENSION);
// Check file size
if ($_FILES["cv"]["size"] > 500000) {
    $msg = "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "pdf" && $imageFileType != "doc" && $imageFileType != "docx"
&& $imageFileType != "txt" ) {
       $msg = "Only doc, docx, pdf, & txt files are allowed.";
    	$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
        $msg = $msg."<br /> Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
     if(move_uploaded_file($_FILES['cv']['tmp_name'], $target))
    {
		//Writes the information to the database
   		mysql_query("insert into `career`(`name`, `phone`, `email`, `address`,`education`,`cv`)
		values('$name','$phone','$email','$address','$education','$target')");
		$msg="Your Request Has been Sent! Successfully You will be contacted Soon!";
    }
}



/*   // Check file size
if ($_FILES["cv"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
}
 */   ?>
<!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>Frontier Public High School</title>
<link rel="stylesheet" type="text/css" href="styles/my.css"  />
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>

<script>
$("#myslideshow > div:gt(0)").hide();

setInterval(function() { 
  $('#myslideshow > div:first')
    .fadeOut(1000)
    .next()
    .fadeIn(1000)
    .end()
    .appendTo('#myslideshow');
},  3000);
</script>
</head>

<body>
<!-- Wrapper Starts Here -->
<div id="wrapper">
<?php 
include("includes/header.php");
//include("includes/slideshow.php");
?>
<!-- Contents Starts -->
<div class="content"><h3><?php echo $msg; ?></h3>
</div>
<!-- Contents Ends -->
<?php
include("includes/sidebar.php");
include("includes/footer.php");
?>
</div>
<!-- Wrapper Ends -->
</body>
</html>
