ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/syllabus-file-add.php |
<?php include "header.php";?> <?php if(isset($_POST['add_pdf'])){ try{ $date = date("Y-m-d"); if(isset($_FILES['photo']) && $_FILES["photo"]["name"]!=""){ $extension = end(explode(".", $_FILES["photo"]["name"])); $image = rand(10,1000000000)."-image." . $extension; $upload = move_uploaded_file($_FILES['photo']['tmp_name'], '../pdf/' . $image); $upload_image = '../pdf/' . $image; } $statement = $pdo->prepare("INSERT INTO `tbl_pdf`(`file_name`,`file`)VALUES (?,?)"); $result = $statement->execute(array($_POST['pdf_name'],$upload_image,)); if($result){ echo '<script type="text/javascript"> alert("New PDF File Added successfully"); window.location.href = "syllabus-file-add.php"; </script>'; unset($_POST); }else{ echo '<script type="text/javascript"> alert("Something went wrong try again..."); window.location.href = "syllabus-file-add.php"; </script>'; } }catch(Exception $e){ $error=$e; } } ?> <div class="content-wrapper" style="background:white;"> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <div> <div class="box-header"> <h3 class="box-title"><b>Add New Banner Image: </b></h3> </div> <div class="box-body"> <div class="col-lg-12"> <!--<div id="loading-div"> <center><img src="assets/load.gif" style="10%"><br> <strong class="blink_me">Loading Pls Wait... </strong></center> </div> <div id="success-div"> </div>--> <div id="content-div"> <form action="" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label class="required" for="file">Choose The PDF File</label> <input type="file" name="photo" id="photo" value="" placeholder="Choose The banner Image" class="form-control tip" required="required" /> </div> <span style="color: red;" id="photospan"></span> </div> <div class="col-md-4"> <div class="form-group"> <label class="required" for="file">PDF Name :</label><br> <input type="text" id="pdf_name" name="pdf_name" value="" class="form-control tip" /> </div> </div> </div> <div class="col-md-12"> <div class="form-group" style="text-align: center;"> <input type="submit" id="add_pdf" name="add_pdf" value="Add Pdf" class="btn btn-success" /> </div> </div> </form> </div> <div class="form-group" style="text-align:center;"> <a href="syllabus-file-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="syllabus-file-list.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <style> table,td,th{ padding:5px; } th{ border: 1px solid black; } td{ border: 1px solid black; border-style: dashed; } </style> <?php include "footer.php";?>