Server IP : 184.154.167.98 / Your IP : 3.16.50.94 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/oficios/chido/ |
Upload File : |
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <?php include('conexion.php'); $tmp = array(); $res = array(); $sel = $con->query("SELECT * FROM files"); while ($row = $sel->fetch_assoc()) { $tmp = $row; array_push($res, $tmp); } ?> <html> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> </head> <body> <div class="container"> <div class="row justify-content-md-center"> <div class="col-md-auto"> <h1>Subir Archivos</h1> </div> </div> <div class="row justify-content-md-center"> <div class="col-8"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"> Nuevo </button> <table class="table mt-2"> <thead> <tr> <th scope="col">id</th> <th scope="col">titulo</th> <th scope="col">descripcion</th> <th scope="col">Acciones</th> <th scope="col">URL</th> </tr> </thead> <tbody> <?php foreach ($res as $val) { ?> <tr> <td><?php echo $val['id'] ?> </td> <td><?php echo $val['title'] ?></td> <td><?php echo $val['description'] ?></td> <td> <button onclick="openModelPDF('<?php echo $val['url'] ?>')" class="btn btn-primary" type="button">Ver Archivo Modal</button> <a class="btn btn-primary" target="_black" href="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/' . $val['url']; ?>" >Ver Archivo pagina</a> </td> <td><?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/' . $val['url']; ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Nuevo archivo</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form enctype="multipart/form-data" id="form1"> <div class="form-group"> <label for="title">Gerencia</label> <select name="title"> <option value="APIT-GAF">APIT-GAF</option> <option value="APIT-DG-GAF" selected>APIT-DG-GAF</option> </select> <!--<input type="text" class="form-control" id="title" name="title">--> </div> <div class="form-group"> <label for="description">Fecha Oficio</label> <!--<input type="text" class="form-control" id="description" name="description"> --> <input type="date" id="description" name="description" value="<?php echo date("Y-m-d");?>"> </div> <div> <label for="title">Vía</label> <select name="title"> <option value="Personal">Personal</option> <option value="Mensajeria" selected>Mensajeria</option> <option value="Email" selected>Email</option> </select> </div> <div> <label for="title">Tipo de Oficio</label> <select name="title"> <option value="Normal">Normal</option> <option value="Calidad" selected>Calidad</option> <option value="Ambiental" selected>Ambiental</option> </select> </div> <div class="form-group"> <label for="description">archivo</label> <input type="file" accept="application/pdf" class="form-control" id="file" name="file"> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button> <button type="button" class="btn btn-primary" onclick="onSubmitForm()">Cuardar</button> </div> </div> </div> </div> <div class="modal fade" id="modalPdf" tabindex="-1" aria-labelledby="modalPdf" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Ver archivo</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <iframe id="iframePDF" frameborder="0" scrolling="no" width="100%" height="500px"></iframe> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script> function onSubmitForm() { var frm = document.getElementById('form1'); var data = new FormData(frm); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4) { var msg = xhttp.responseText; if (msg == 'success') { alert(msg); $('#exampleModal').modal('hide') } else { alert(msg); } } }; xhttp.open("POST", "upload.php", true); xhttp.send(data); $('#form1').trigger('reset'); } function openModelPDF(url) { $('#modalPdf').modal('show'); $('#iframePDF').attr('src','<?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/'; ?>'+url); } </script> </body> </html>