/
home
/
dityaelevator
/
public_html
/
elevator_master
/
Upload File
HOME
<?php error_reporting(0); include("include/header.php"); $_SESSION['page_menu']=array('website','download'); if(!empty($_POST['download'])){ $obj->download(); } if(!empty($_POST['mul_del'])){ foreach($_POST['mul_del'] as $code) { $id= $code; $photo_sql= "SELECT file_name FROM download WHERE download_id='".$id."'"; $rs= mysqli_query($obj->mysqli,$photo_sql); $photo= mysqli_fetch_assoc($rs); if(is_file('_saving/download/'.$photo['file_name'])){ unlink('_saving/download/'.$photo['file_name']); } } $col= 'download_id'; $table= 'download'; $page= 'download.php'; $img= "file_name"; $path= "_saving/download/"; $obj->delete_multiple($col,$table,$page,$path); } if(!empty($_REQUEST['edit'])){ $val= $_REQUEST['edit']; $row= $obj->getRecord('download','download_id',$val); } ?> <aside class="main-sidebar"> <section class="sidebar"> <?php include ('include/sidebar.php'); ?> <?php include 'include/admin-menu.php'; ?> </section> </aside> <div class="content-wrapper"> <?php if(!empty($_REQUEST['msg'])){ echo '<section class="content-header" id="error"> <div class="row"> <div class="col-md-12"> <div class="alert alert-success alert-dismissable" > <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <span><i class="icon fa fa-check"></i>'.$_REQUEST['msg'].'</span> </div> </div> </div> </section>'; } ?> <?php if(!empty($obj->errorMsg)){ ?> <section class="content-header" id="error"> <div class="row"> <div class="col-md-12"> <div class="alert alert-success alert-dismissable" > <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <h4><i class="icon fa fa-check"></i><?php echo $obj->errorMsg; ?></h4> </div> </div> </div> </section> <?php } ?> <section class="content-header"> <h1> Download Entry </h1> <div class="col-lg-12"> <ol class="breadcrumb"> <li><a href="admin-dashboard.php"><i class="fa fa-dashboard"></i> Dashboard</a></li> <li class="active"><a href="">Website </a></li> <li class="active"> Download</li> </ol> </div> </section> <section class="content"> <div class="row"> <div class="col-md-12"> <div class="box box-primary"> <form role="form" action="" method="post" enctype="multipart/form-data" name="testimonial_form" id="franchises_form" data-toggle="validator"> <div class="box-body"> <div class="form-group"> <label>File Title *</label> <input type="text" class="form-control" name="file_title" placeholder="Title" value="<?= isset($row)? $row['file_title'] : ''?>" <?= (!isset($row))? 'required' : '' ?> autocomplete="off"> </div> <div class="form-group"> <label>File <span style="color:#990000">(Please Upload pdf/doc/docx file)</span></label> <input type="file" class="form-control" <?= (!isset($row))? 'required' : '' ?> name="file_name"> </div> <input type="hidden" name="download" value="1"> <?php if(isset($row)== TRUE){ ?> <input type="hidden" name="download_id" value="<?= $row['download_id']?>" /> <input type="hidden" name="file_name" value="<?= $row['file_name']?>" /> <?php } ?> <button type="submit" name="submit" class="btn btn-primary"><?= isset($row)? 'Update' : 'Save'?></button> <button type="reset" name="reset" class="btn btn-primary">Reset </button> </div> </form> </div> </div> </div> </section> <section class="content-header"> <h1>Download View <small></small> </h1> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title"></h3> </div> <div class="box-body"> <form id="vnews" action="download.php" method="post"> <div class="table-responsive"> <table id="example1" class="table table-bordered table-striped table-responsive"> <thead> <tr> <th>#</th> <th>Sr. No.</th> <th>Title</th> <th>File</th> <th>Date</th> <th>Action</th> </tr> </thead> <?php $res= $obj->getTable('download','download_id desc'); if($res){ $i=1; foreach($res as $download_data){ ?> <tbody> <tr> <td scope="col"><input type="checkbox" name="mul_del[]" value="<?= $download_data['download_id'] ?>" /></td> <td><?= $i++; ?></td> <td><?= $download_data['file_title'] ?></td> <td><a target="_blank" href="_saving/download/<?= $download_data['file_name'] ?>"><?= $download_data['file_name'] ?></a></td> <td><?= $download_data['sub_date'] ?></td> <td> <a class="btn btn-info btn-xs" href="download.php?edit=<?= $download_data['download_id']?>"> <i class="glyphicon glyphicon-edit icon-white"></i> Edit </a> <a class="btn btn-danger btn-xs" href="javascript:muldelete()"> <i class="glyphicon glyphicon-trash icon-white"></i> Del</a> </td> </tr> </tbody> <?php } } ?> </table> </div> </form> </div> </div> </div> </div> </section> </div> <?php include 'include/footer.php'; ?> <div class="control-sidebar-bg"></div> </div> <!-- ./wrapper --> <script src="plugins/jQuery/jQuery-2.1.4.min.js"></script> <script type="text/javascript"> function muldelete() { element_lenght= vnews.elements.length; for(i=0;i<element_lenght;i++) { if(vnews.elements[i].name=="mul_del[]") { if(vnews.elements[i].checked==true) { if(confirm("Are you sure delete record(s)?")) { this.vnews.submit(); break; } } } } } </script> <script src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="js/jquery.dateselect.js"></script> <script src="js/jquery-ui.min.js"></script> <script> $.widget.bridge('uibutton', $.ui.button); </script> <script src="bootstrap/js/bootstrap.min.js"></script> <script src="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables/dataTables.bootstrap.min.js"></script> <script src="dist/js/app.min.js"></script> <script> $(function () { $("#example1").DataTable(); $('#example2').DataTable({ "paging": true, "lengthChange": false, "searching": false, "ordering": true, "info": true, "autoWidth": true }); }); </script> <script src="js/jquery.validate.min.js"></script> <script src="js/jquery-validate-additional-methods.js"></script> <script> $(document).ready(function(){ $.validator.addMethod('filesize', function(value, element, param) { return this.optional(element) || (element.files[0].size <= param) }); $('#franchises_form').validate({ rules: { program_dip: { required: true }, protit_id: { required: true }, gal_image: { accept: "png|jpeg|jpg|gif", filesize: 391000 }, }, messages: { program_dip: { required: "Please Enter Discription", }, protit_id: { required: "Please Enter Title", }, gal_image: { accept: "please upload png|jpeg|jpg|gif file only", filesize: 'please upload maximum size 391kb' }, }, highlight: function(element){ $(element).closest('.form-group').addClass('has-error').removeClass('has-success'); //$(element).next('span').addClass('fa fa-times-circle').removeClass('fa fa-check-circle'); }, unhighlight: function(element){ $(element).closest('.form-group').addClass('has-success').removeClass('has-error'); //$(element).next('span').addClass('fa fa-check-circle').removeClass('fa fa-times-circle'); }, errorElement: 'span', errorClass: 'help-block', //errorPlacement: '', }); }); function livesearch(e,r) { var textfield= document.getElementById(e); var regx= new RegExp(r, 'g'); textfield.value= textfield.value.replace(regx,''); } </script> </body> </html>