kohjhjhصثقص5572hjkhk7872ثقصثقgdfgdg
Ele57885fddfg872782782782 hjkhj782dfgfghgقفغفغفقhfg555434536
/
home4
/
kisgavwq
/
dmcschool.ac.in
/
dmcadmin
/
includes
/
Upload FileeE
HOME
<?php $conn = mysqli_connect(SYSTEM_DBHOST, SYSTEM_DBUSER, SYSTEM_DBPWD, SYSTEM_DBNAME); $required = "<font color='#FF0000' size='1'>*</font>"; if($_GET['q']!="edit"){ header("Location:managetc.php"); } $id=$_GET['id']; $tc_data=$dbObj->fetch_data("tbl_tc","sr_no='$id'"); if(isset($_POST['update_tc'])){ $id=$_POST['tc_id']; $name=$_POST['name']; $grade=$_POST['grade']; $addmission_no=$_POST['admission_no']; $cer_upload=$_FILES['cer_data']['name']; $upload_type=$_FILES['cer_data']['type']; if($cer_upload!=""){ if($upload_type == "jpg" || $upload_type == "png" || $upload_type == "jpeg" || $upload_type == "gif" || $upload_type == "application/pdf"){ $ext=end((explode(".", $cer_upload))); $fname=strtoupper($name).$addmission_no.substr($addmission_no,-2).date('jnyB').".".$ext; $destinition="tc_upload/".$fname; if(move_uploaded_file($_FILES['cer_data']['tmp_name'], $destinition)){ $tc_doc=$fname; } else{ $tc_doc=$_POST['view_data']; } // move_uploaded_file($_FILES['cer_data']['tmp_name'], $destinition); $query_tc=$dbObj->updateToDb("tbl_tc","name='$name',grade='$grade',admission_no='$addmission_no',view='$tc_doc'","sr_no='$id'"); echo "<script>alert('Data Updated Successfully.');</script>"; echo "<script>window.location='managetc.php';</script>"; //header("Location:managetc.php"); } else{ echo "<script>alert('Sorry, only JPG, JPEG, PNG, GIF & PDF files are allowed.');</script>"; echo "<script>window.location='managetc.php?q=edit&id=".$id."';</script>"; //header("Location:managetc.php?q=edit"); } }else{ $tc_doc=$_POST['view_data']; $query_tc=$dbObj->updateToDb("tbl_tc","name='$name',grade='$grade',admission_no='$addmission_no',view='$tc_doc'","sr_no='$id'"); echo "<script>alert('Data Updated Successfully2.');</script>"; echo "<script>window.location='managetc.php';</script>"; //header("Location:managetc.php"); } } ?> <div class="content_header"> <div class="heading flleft">Edit Transfer Certificate</div> <div class="heading flright"><a href="<?=$_curpage?>">« Back</a></div> </div> <div class="bodycontent"> <form name="form1" method="post" action="" enctype="multipart/form-data"> <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center"> <tr> <td width="14%" align="left" class="label">Name<?=$required?></td> <td width="1%" align="center">:</td> <td width="85%" align="left"> <input type="hidden" name="tc_id" value="<?=$tc_data[0]['sr_no']?>"> <input type="text" name="name" size="50" value="<?=$tc_data[0]['name']?>" required/></td> </tr> <tr> <td width="14%" align="left" class="label">Grade<?=$required?></td> <td width="1%" align="center">:</td> <td width="85%" align="left"> <input type="text" name="grade" size="50" value="<?=$tc_data[0]['grade']?>" required/></td> </tr> <tr> <td width="14%" align="left" class="label">Admission No.<?=$required?></td> <td width="1%" align="center">:</td> <td width="85%" align="left"> <input type="text" name="admission_no" size="50" value="<?=$tc_data[0]['admission_no']?>" required/></td> </tr> <tr> <td width="14%" align="left" class="label">Certificates<?=$required?></td> <td width="1%" align="center">:</td> <td width="85%" align="left"> <input type="file" name="cer_data" size="50"/> <span><?=$tc_data[0]['view']?></span> <input type="hidden" name="view_data" value="<?=$tc_data[0]['view']?>"> </td> </tr> <tr> <td colspan="3" align="center"> <p> <input type="submit" value="Update Transform Certificate" class="button" name="update_tc" /> </p> </td> </tr> </table> </form> </div>