SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | error_reporting(E_ALL); | |
| 3 | ?> | |
| 4 | ||
| 5 | <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"> | |
| 6 | <?php if ($_GET[act] == '') { ?>
| |
| 7 | <div class="col-xs-12"> | |
| 8 | <div class="box"> | |
| 9 | <div class="box-header"> | |
| 10 | <h3 class="box-title">Data Kelas </h3> | |
| 11 | <?php if ($_SESSION[level] != 'kepala') { ?>
| |
| 12 | <a class='pull-right btn btn-primary btn-sm' href='index.php?view=kelas&act=tambah'>Tambahkan Data</a> | |
| 13 | <a class='pull-right' ><span></span> </a> | |
| 14 | <a class='pull-right btn btn-success btn-sm' href='index.php?view=kelas&act=importkelas'><i class="fa fa-upload" aria-hidden="true"></i> Import Kelas</a> | |
| 15 | - | <?php } ?> |
| 15 | + | |
| 16 | <a class='pull-right btn btn-warning btn-sm' href='export/export_kelas.php?'><i class="fa fa-file-excel-o" aria-hidden="true"></i> Export Kelas</a> | |
| 17 | - | if (isset($_POST[submit])) {
|
| 17 | + | |
| 18 | - | $file = $_FILES['filerb_kelasall']['name']; |
| 18 | + | |
| 19 | <?php } | |
| 20 | - | $file_name = "file-".round(microtime(TRUE)).".".end($ekstensi); |
| 20 | + | |
| 21 | - | $sumber = $_FILES['filerb_kelasall']['tmp_name'] ; |
| 21 | + | |
| 22 | - | $target_dir = "../file_import/" ; |
| 22 | + | if (isset($_POST['drop'])) {
|
| 23 | - | $target_file = "$target_dir.$file_name"; |
| 23 | + | $file = $_FILES['file_import']['name']; |
| 24 | - | move_uploaded_file($sumber, $target_file); |
| 24 | + | |
| 25 | $file_name = "file-".round(microtime(TRUE)).".xls";//.end($ekstensi); | |
| 26 | $sumber = $_FILES['file_import']['tmp_name'] ; | |
| 27 | ||
| 28 | $target_dir = "file_import" ; | |
| 29 | if(!is_dir($target_dir)){
| |
| 30 | mkdir($target_dir);//membuat folder | |
| 31 | } | |
| 32 | $target_file = $target_dir."/".$file_name ; | |
| 33 | $upload = copy($sumber, $target_file); | |
| 34 | if($upload){
| |
| 35 | echo "upload sukses"; | |
| 36 | } else {
| |
| 37 | echo "<center>UPLOAD GAGAL</center>"; | |
| 38 | } | |
| 39 | } | |
| 40 | echo "<div class='col-md-12'> | |
| 41 | <div class='box box-info'> | |
| 42 | <div class='box-header with-border'> | |
| 43 | <h3 class='box-title'>Import Kelas</h3> | |
| 44 | - | <input type='file' id='filerb_kelasall' name='filerb_kelasall' class='form-control' required> |
| 44 | + | |
| 45 | <div class='box-body'> | |
| 46 | <form method='POST' class='form-horizontal' action='' enctype='multipart/form-data'> | |
| 47 | <div class='col-md-12'> | |
| 48 | <table class='table table-condensed table-bordered'> | |
| 49 | <tbody> | |
| 50 | <tr> | |
| 51 | <th rowspan='3' width='120px' scope='row'>PILIH FILE</th> | |
| 52 | <td> | |
| 53 | <input type='file' id='filerb_kelasall' name='file_import' class='form-control' required> | |
| 54 | </td> | |
| 55 | <tr> | |
| 56 | <td> | |
| 57 | <button type='submit' name='submit' class='btn btn-success btn-block'>IMPORT</button> | |
| 58 | </td> | |
| 59 | </tr> | |
| 60 | <tr> | |
| 61 | <td> | |
| 62 | <label><input type='checkbox' name='drop' value='1' /> <u>Kosongkan Semua Data Yang Sudah Ada.</u> </label> | |
| 63 | </td> | |
| 64 | </tr> | |
| 65 | </tr> | |
| 66 | <tr> | |
| 67 | <th rowspan='2'>PETUNJUK</th> | |
| 68 | <td>1. FILE YANG DI UPLOAD HARUS DARI MS. EXCEL 2003 *. xls</td> | |
| 69 | <tr> | |
| 70 | <td>2. DENGAN MEN CENTANG ANDA AKAN YAKIN MENGHAPUS SEMUA DATA YANG SUDAH ADA SEBELUMNYA</td> | |
| 71 | </tr> | |
| 72 | </tr> | |
| 73 | </tbody> | |
| 74 | </table> | |
| 75 | </div> | |
| 76 | </div> | |
| 77 | <div class='box-footer'> | |
| 78 | <a href='index.php?view=kelas'><button type='button' class='btn btn-info pull-right'>Kembali</button></a> | |
| 79 | </div> | |
| 80 | </form> | |
| 81 | </div>"; | |
| 82 | } | |
| 83 | ?> |