JezK
Edit File: stockStatements.php
<?php $currentPage="home"; include("header.php"); $userID = ""; if(isset($_GET['id'])) { $userID = $_GET['id']; if(trim($userID) == '') { echo "<script>location.replace('home.php')</script>"; } else { include("app/getStockData.php"); } } else { echo "<script>location.replace('home.php')</script>"; } if(isset($_SESSION['fileNotExists'])) { echo "<script>alert('Error!!! Unable to download file. File doesnot exists.');</script>"; unset($_SESSION['fileNotExists']); } ?> <div id="page-wrapper"> <div class="container-fluid"> <!-- Page Heading --> <div class="row"> <div class="col-lg-12"> <h1 class="page-header text-center"> <small style="color: #333333;">Stock Statements </small> </h1> </div> </div> <!-- /.row --> <div class="container main" > <div class="col-md-12 table-responsive"> <table id='example' class="table table-striped table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>S.No</th> <th>Submitted Date</th> <th>Stock Statement</th> <th>Remarks</th> </tr> </thead> <tbody> <?php echo $data; ?> </tbody> </table> </div> </div> </div> <!-- /.container-fluid --> </div> <!-- /#page-wrapper --> <script> $(document).ready(function(){ $("#stockStatement").hide(); $("#btn").click(function(){ $("#stockStatement").trigger("click"); }); }); pdfFlag = 1; function ValidateFileUpload(fileID) { var fuData = document.getElementById(fileID); var FileUploadPath = fuData.value; //To check if user upload any file if (FileUploadPath == '') { alert("Please upload a pdf/doc/docx file."); return false; } else { var Extension = FileUploadPath.substring( FileUploadPath.lastIndexOf('.') + 1).toLowerCase(); //The file uploaded is an pdf if (Extension == "pdf" || Extension == "doc" || Extension == "docx") { var size=1048576; var file_size=fuData.files[0].size; if(file_size>=size) { alert('File too large'); return false; } else { pdfFlag = 1; return true; } } //The file upload is NOT an pdf else { alert("Please upload a pdf/doc/docx file."); return false; } } } </script> <?php include"footer.php"?>