hey,can any1 tell me what im doin wrong here.im trying to upload a pdf file but the file is not gettin uploaded.here's my code
<?php
require_once "../inc/functions.php";
sessionCheck();
session_start();
$old_sessionid = session_id(); //i've added these lines
session_regenerate_id(); //i've added these lines
$new_sessionid = session_id();
if($_POST['submit'] && $_FILES['txtFile']['name']){
global $uploadPath;
$cat=$_GET['cat'];
$subcat=$_POST['subcat'];
$keyword = ($_POST['txtkeyword']);
$date=$_POST['txtDate'];
$upload_file_size = 7;
$path = $uploadPath;
echo $_FILES['txtFile']['type'];
echo $_FILES['txtFile']['size'];
if($_FILES['txtFile']['type']=="application/pdf" && $_FILES['txtFile']['size']< ($upload_file_size*1048576)){
$newName = time().$_FILES['txtFile']['name'];
$chk = @move_uploaded_file($_FILES['txtFile']['tmp_name'],"../".$uploadPath."/".$newName);
if($chk){
$sql = "INSERT INTO `pan_document_sub_master`(
`pan_doc_sub_id`,
`pan_doc_gazetted`,
`pan_document_type`,
`pan_doc_name`,
`pan_doc_keyword`,
`pan_doc_date`,
`pan_doc_path`
)
VALUES(
'' ,'".$cat."','".$subcat."','".$_FILES['txtFile']['name']."','".$keyword."','".$date."','".$newName."'
);";
$row =caseQuery($sql);
if($row){
$msg = "File Uploaded";
}else{
$msg = "File Uploading Failed";
}
}else{
$msg = "File Uploading1 Failed";
}
}else{
$msg = "The Uploading Document Should be in PDF format and should be less than ".($upload_file_size)."mb";
}
}
/*
if(isset($_GET['del'])){
$id = $_GET['id'];
if(is_numeric($id)){
$sql = "SELECT * FROM pan_document_sub_master WHERE pan_doc_sub_id=".$id."";
$row = caseQuery($sql);
if(@mysql_num_rows($row)){
$res = @mysql_fetch_object($row);
$delPath = "../".$uploadPath."/".$res->pan_doc_path;
$delStatus = @unlink($delPath);
if($delStatus){
$sql = "DELETE FROM `pan_document_sub_master` WHERE `pan_document_sub_master`.`pan_doc_sub_id` = ".$id."";
$res = @caseQuery($sql) or false;
if($res){
$msg = "File Deleted";
}
}else{
$msg = "File Deletion Failed";
}
}/*else{
$msg = "File Not Found";
}
}else{
$msg = "File Not Found32";
}
}*/
include_once "admin_templates/case_header.php";
?>
<script type="text/javascript">
function checkForm(){
var keyword = document.getElementById('txtkeyword').value;
var file =document.getElementById('txtFile').value;
var Dte =document.getElementById('txtDate').value;
var cmbGazette =document.getElementById('cat').value;
if( cmbGazette && keyword && file && Dte ){
document.frmSubmit.submit();
}else{
alert("Some Fields are required");
}
}
</script>
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='upload.php?cat=' + val ;
}
</script>
<?
@$cat=$_GET['cat'];
if(strlen($cat) > 0 and !is_numeric($cat)){
echo "Data Error";
exit;
}
$quer2=caseQuery("SELECT DISTINCT gazetted,cat_id FROM category order by gazetted");
if(isset($cat) and strlen($cat) > 0){
$quer=caseQuery("SELECT DISTINCT pan_doc_type FROM pan_document_master where pan_doc_gazetted=$cat order by pan_doc_type");
}//else{$quer=caseQuery("SELECT DISTINCT type FROM subcategory order by type"); }
?>
<h2 align="center">Upload Pages Control</h2>
<br />
<fieldset style="width:20px">
<legend ><b>Document Upload</b></legend>
<form method="POST" enctype="multipart/form-data" name="frmSubmit">
<table width="250" border="0">
<tr>
<td>Gazetted:</td>
<td> <?php
echo "<select name='cat' onchange=\"reload(this.form)\" ><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['cat_id']==@$cat){echo "<option selected value='$noticia2[cat_id]'>$noticia2[gazetted]</option>"."<BR>";}
else{echo "<option value='$noticia2[cat_id]'>$noticia2[gazetted]</option>";}
}
echo "</select>";
?></td>
</tr>
<tr>
<td>
Documenttype
</td>
<td><?php
echo "<select name='subcat' ><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($quer)) {
echo "<option value='$noticia[pan_doc_type]'>$noticia[pan_doc_type]</option>";
}
echo "</select>";
?></td>
</tr>
<tr>
<td>
Keyword
</td>
<td>
<input type="text" name="txtkeyword" id="txtkeyword" />
</td>
</tr>
<tr>
<td>
Date
</td>
<td>
<input name="txtDate" id="txtDate" type="text" size="10" readonly="readonly" class="box" />
<link type="text/css" rel="stylesheet" href="../inc/jscalender/css/jscal2.css" />
<link type="text/css" rel="stylesheet" href="../inc/jscalender/css/border-radius.css" />
<link id="skin-win2k" title="Win 2K" type="text/css" rel="alternate stylesheet" href="../inc/jscalender/css/win2k/win2k.css" />
<link id="skinhelper-compact" type="text/css" rel="alternate stylesheet" href="../inc/jscalender/css/reduce-spacing.css" />
<script src="../inc/jscalender/js/jscal2.js"></script>
<script src="../inc/jscalender/js/lang/en.js"></script>
<img src="../images/cal.gif" id="statusDate" width="16" height="16" border="0" alt="Pick a date" /></a>
<script type="text/javascript">
new Calendar({
inputField: "txtDate",
dateFormat: "%d-%m-%Y",
trigger: "statusDate",
bottomBar: false,
onSelect: function() {
var date = Calendar.intToDate(this.selection.get());
this.hide();
}
});
</script>
</td>
</tr>
<tr>
<td>
File
</td>
<td>
<input type="file" name="txtFile" id="txtFile"> </td>
</tr>
</table>
<input name="submit" type="submit" value="Upload" onClick="return checkForm();" />
 
</form>
</fieldset>
<p style="color:red"><?=$msg;?></p><!--
<span><h3>List of Download Files Available</h3></span>
<?=AdminUpload();?> -->
<?php include_once "admin_templates/case_footer.php"; ?>