upload pdf and check if PDF exist, PHP

<html>

<body>
<p style="color: red"> -Please choose pdf file and select yes if you want this PDF in your site</p>
<form action ="upload.php" method="post" enctype="multipart/form-data">
File:
<input type="file" name="file" size="30">

  <input type="radio" name="select" value="yes" checked="checked">Yes
  <input type="radio" name="select" value="no">No

<input type="submit" value="upload!">
</form>
</body>
</html>

<?php


$uploaddir = "upload";
$allowed_ext = "pdf";
$max_size = "5000000";
//$max_height = "";
//$max_width = "";

$extension = pathinfo($_FILES['file'] ['name']);
$extension = $extension[extension];
$allowed_paths = explode(", ", $allowed_ext);
for($i = 0; $i < count($allowed_paths); $i++) {
if ($allowed_paths [$i] == "$extension") {
 $ok = "1";
}
}


if ($ok == "1")  {
 if($_FILES['file']['size'] > $max_size)
 {
     print "File is too big!";
     exit;
 }

// Include for images
//if ($max_width && $max_height) {
//list ($width, $height, $type, $w) =
//getimagesize($_FILES['file']['tmp_name']);
//if ($width . $max_width || $height > $max_height)
//{
//print "File height and/or width are too big!";
//exit;
//}
//}

if(is_uploaded_file($_FILES['file']['tmp_name']))
{
move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']);
}
print "Your Cover Letter has been successfully uploaded!";

$myFile = "upload/test21.csv";
$fh = fopen($myFile, 'r+') or die("can't open file");
$stringData = $_POST['select'];
fwrite($fh, $stringData);
$stringData =", ".$_FILES['file']['name'];
fwrite($fh, $stringData);
fclose($fh);

$fh = fopen("upload/test21.csv", "r");
while (($data = fgetcsv($fh,'',",")) !== false) {
foreach ($data as $value) {
if($value=='0') echo "I am in zero";
else
   echo $value . "<br />\n";
}
}

echo $value;
fclose($fh);

}
else {
print "Incorrect file extension!";

$myFile = "upload/test21.csv";
$fh = fopen($myFile, 'r+') or die("can't open file");
$stringData = "no";
fwrite($fh, $stringData);
$stringData =",emptyFile";
fwrite($fh, $stringData);
fclose($fh);

}

?>

print PDF PHP

<!DOCTYPE html>
<html>
<head>
<script>function iprint(ptarget){
        ptarget.focus();
        ptarget.print();
         }
</script>

</head>
<body>




<iframe name="theiframe" id="theiframe" width="500" height="200" src="dw.pdf" style="display:none">
</iframe>
     <input type="button" value="print iframe" onclick="iprint(theiframe);" />
</body>
</html>

Set Up Apache Virtual Hosts

Enable the new VirtualHost using the a2ensite utility and restart Apache2:
sudo a2ensite mynewsite
sudo /etc/init.d/apache2 restart


Similarly, use the a2dissite utility to disable sites. This is can be useful when troubleshooting configuration problems with multiple VirtualHosts:
sudo a2dissite mynewsite
sudo /etc/init.d/apache2 restart