当前位置: 首页>>代码示例>>PHP>>正文


PHP Upload::getFileTo方法代码示例

本文整理汇总了PHP中Upload::getFileTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Upload::getFileTo方法的具体用法?PHP Upload::getFileTo怎么用?PHP Upload::getFileTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Upload的用法示例。


在下文中一共展示了Upload::getFileTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateUangSkripsi

 public function updateUangSkripsi()
 {
     if (isset($_POST['ubah_uskripsi'])) {
         if (isset($_POST['js']) && $_POST['js'] == 1) {
             header('location:' . URL . 'elemenBeasiswa/viewSkripsi');
         }
         if ($_POST['kd_el'] && $_POST['setuju'] != "" && $_POST['r_elem'] != "" && $_POST['kode_jur'] != "" && $_POST['tahun_masuk'] != "" && $_POST['biaya_skripsi'] != "" && $_POST['total_bayar'] != "") {
             $elem = new ElemenBeasiswa();
             $pb = $_POST['setuju'];
             $jml_peg = count($pb);
             $elem->set_kd_d($_POST['kd_el']);
             $elem->set_jml_peg($jml_peg);
             $elem->set_kd_r($_POST['r_elem']);
             $elem->set_kd_jur($_POST['kode_jur']);
             $elem->set_thn_masuk($_POST['tahun_masuk']);
             $elem->set_biaya_per_peg(str_replace(',', '', $_POST['biaya_skripsi']));
             $elem->set_total_bayar(str_replace(',', '', $_POST['total_bayar']));
             $elem->set_no_sp2d($_POST['no_sp2d']);
             $elem->set_tgl_sp2d(date('Y-m-d', strtotime($_POST['tgl_sp2d'])));
             //var_dump($elem);
             //echo $kd_elemen_beasiswa;
             //exit();
             //var_dump($elem);
             $upload = new Upload();
             $upload->init('fupload');
             if ($upload->getFileName() != "") {
                 $upload->setDirTo("files/sp2d/");
                 $nama = array($elem->get_no_sp2d(), $elem->get_tgl_sp2d());
                 //$upload->uploadFile2("", $nama);
                 if ($upload->uploadFile2("", $nama) == false) {
                     $url = URL . 'elemenBeasiswa/editJadup/' . $elem->get_kd_d();
                     echo '<script> alert("File gagal diupload.") </script>';
                     echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>';
                     exit;
                 }
                 $elem->set_file_sp2d($upload->getFileTo());
                 //echo $upload->getFileName();
                 if ($_POST['fupload_lama'] != "") {
                     $file = "files/sp2d/" . $_POST['fupload_lama'];
                     //echo $file;
                     if (file_exists($file)) {
                         unlink($file);
                     }
                 }
                 //echo $upload->getFileName();
             } else {
                 if ($_POST['fupload_lama'] != "") {
                     $elem->set_file_sp2d($_POST['fupload_lama']);
                     //echo $_POST['fupload_lama'];
                 } else {
                     $elem->set_file_sp2d("");
                 }
             }
             $elem->update_elem($elem);
             $penerima = new PenerimaElemenBeasiswa();
             $penerima->delete($elem->get_kd_d());
             foreach ($pb as $val) {
                 $penerima_elemen = new PenerimaElemenBeasiswa();
                 $penerima_elemen->kd_elemen_beasiswa = $elem->get_kd_d();
                 $penerima_elemen->kd_pb = $val;
                 $penerima_elemen->add($penerima_elemen);
             }
             ClassLog::write_log("elemen beasiswa", "ubah uang penelitian", "kd_el." . $elem->get_kd_d());
             //$url = URL . 'elemenBeasiswa/editSkripsi/' . $elem->get_kd_d();
             $url = URL . 'elemenBeasiswa/viewSkripsi';
             echo '<script> alert("Data berhasil disimpan") </script>';
             echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>';
         } else {
             header('location:' . URL . 'elemenBeasiswa/editSkripsi/' . $elem->get_kd_d());
         }
     } else {
         header('location:' . URL . 'elemenBeasiswa/viewSkripsi');
     }
 }
开发者ID:nazimkabiri,项目名称:sims-beasiswa,代码行数:74,代码来源:ElemenBeasiswaController.php

示例2: updatePembayaran

 public function updatePembayaran()
 {
     //sleep(1);
     if (isset($_POST['update_pembayaran'])) {
         $biaya = new Biaya();
         $biaya->kd_kontrak = $_POST['kd_kontrak'];
         $biaya->kd_biaya = $_POST['kd_biaya'];
         $biaya->no_sp2d = $_POST['no_sp2d'];
         $biaya->tgl_sp2d = date('Y-m-d', strtotime($_POST['tgl_sp2d']));
         if ($_FILES['file_sp2d']['name'] != "") {
             $biaya->file_sp2d = $_FILES['file_sp2d']['name'];
         } else {
             if ($_POST['file_sp2d_lama'] != "") {
                 $biaya->file_sp2d = $_POST['file_sp2d_lama'];
             } else {
                 $biaya->file_sp2d = "";
             }
         }
         $biaya_current = $biaya->get_by_id($biaya->kd_biaya);
         $biaya->status_bayar = $biaya_current->status_bayar;
         //untuk mendapatkan status bayar terkini
         if ($biaya->status_bayar == "belum") {
             //header('location:' . URL . 'kontrak/editBiaya/'.$biaya->kd_biaya);
             $url = URL . 'kontrak/editBiaya/' . $biaya->kd_biaya . "/2";
             //                header("refresh:1;url=" . $url);
             //                echo "Data tagihan biaya belum diisi.";
             echo '<script> alert("Data tagihan biaya belum diisi") </script>';
             echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>';
         } else {
             if ($biaya->isEmptyPembayaran($biaya) == false) {
                 $upload = new Upload();
                 if ($_FILES['file_sp2d']['name'] != "") {
                     $upload->init('file_sp2d');
                     $upload->setDirTo('files/sp2d/');
                     $nama = array($biaya->no_sp2d, $biaya->tgl_sp2d);
                     $upload->uploadFile2("", $nama);
                     $biaya->file_sp2d = $upload->getFileTo();
                     if ($_POST['file_sp2d_lama'] != "") {
                         $file = "files/sp2d/" . $_POST['file_sp2d_lama'];
                         //echo $file;
                         if (file_exists($file)) {
                             unlink($file);
                         }
                     }
                 }
                 $biaya->updatePembayaranTagihan($biaya);
                 ClassLog::write_log("kontrak", "simpan pembayaran biaya kontrak", "kode biaya " . $biaya->kd_biaya . "kode kontrak" . $biaya->kd_kontrak);
                 //$url = URL . 'kontrak/editBiaya/' . $biaya->kd_biaya."/2";
                 $url = URL . 'kontrak/biaya/' . $biaya->kd_kontrak;
                 echo '<script> alert("Data Pembayaran tagihan berhasil disimpan") </script>';
                 echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>';
             } else {
                 //header('location:' . URL . 'kontrak/editBiaya/'.$biaya->kd_biaya);
                 $url = URL . 'kontrak/editBiaya/' . $biaya->kd_biaya . "/2";
                 //angka 2 menunjukan id tab dari pembayaran
                 echo '<script> alert("Isian form pembayaran tagihan biaya belum lengkap") </script>';
                 echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>';
             }
         }
     } else {
         header('location:' . URL . 'kontrak/display');
     }
 }
开发者ID:nazimkabiri,项目名称:sims-beasiswa,代码行数:63,代码来源:KontrakController.php

示例3: editSurat

 public function editSurat()
 {
     $temp = explode(' ', $_POST['tujuan']);
     $tujuan = $temp[0];
     $upload = new Upload('upload');
     //        cek nomor ada yg sama di db ato gak
     if ($_POST['nomor'] != '') {
         $bagian = Session::get('bagian');
         $sql = "SELECT kd_bagian FROM r_bagian WHERE id_bagian=" . $bagian;
         $datab = $this->model->select($sql);
         foreach ($datab as $val) {
             $bagian = $val['kd_bagian'];
         }
         $nomor = $this->model->cekIfExistNomor($_POST['nomor'], $_POST['tipe'], $bagian);
     } else {
         $nomor = $_POST['nomor'];
     }
     $data = array("tipe" => $_POST['tipe'], "tgl_surat" => Tanggal::ubahFormatTanggal($_POST['tgl_surat']), "no_surat" => $nomor, "tujuan" => $tujuan, "perihal" => $_POST['perihal'], "sifat" => $_POST['sifat'], "jenis" => $_POST['jenis'], "lampiran" => $_POST['lampiran']);
     $id = $_POST['id'];
     $where = "id_suratkeluar = '" . $id . "'";
     //        var_dump($data);
     //        var_dump($where);
     //        var_dump($_FILES);
     //echo $where;
     $update = $this->model->editSurat($data, $where);
     if ($update) {
         //status net
         if ($_POST['nomor'] != '') {
             $data = array('status' => 22);
             $this->model->editSurat($data, $where);
         }
         echo "<div id=success>Ubah data surat berhasil</div>";
         //upload file
         if (end(explode('.', $upload->getFileName())) == 'pdf') {
             $upload->setDirTo('arsip/');
         } elseif (end(explode('.', $upload->getFileName())) == 'docx' or end(explode('.', $upload->getFileName())) == 'doc') {
             $upload->setDirTo('arsip/temp/');
         }
         $tipe = 'K';
         $satker = substr($_POST['tujuan'], 0, 8);
         //            $id = 0;
         $sql = "SELECT MAX(id_suratkeluar) as id FROM suratkeluar";
         $did = $this->model->select($sql);
         foreach ($did as $valid) {
             $id_max = $valid['id'];
         }
         //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan)
         $ubahNama = array($tipe, $id, $satker);
         $upload->setUbahNama($ubahNama);
         $upload->changeFileName($upload->getFileName(), $ubahNama);
         $namafile = $upload->getFileTo();
         $where = ' id_suratkeluar=' . $id;
         $data = array('file' => $namafile);
         if ($_FILES['upload']['tmp_name'] != '') {
             $upload->uploadFile();
             $this->model->uploadFile($data, $where);
         }
         @Session::createSession();
         $user = Session::get('user');
         $log = new Log();
         $log->addLog($user, 'UBAH SK', 'user ' . $user . ' ubah surat keluar tujuan: ' . $id . ' perihal:' . $_POST['perihal']);
         unset($log);
         //        return true;
     } else {
         echo "<div id=error>Ubah data surat gagal</div>";
     }
 }
开发者ID:ryderonil,项目名称:sisurip,代码行数:67,代码来源:suratkeluar_controller.php

示例4: uploadFileSurat

 public function uploadFileSurat()
 {
     $upload = new Upload('upload');
     $upload->setDirTo('arsip/');
     $tipe = 'M';
     $satker = $_POST['satker'];
     $nomor = $_POST['nomor'];
     //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan)
     $ubahNama = array($tipe, $nomor, $satker);
     $upload->setUbahNama($ubahNama);
     $upload->changeFileName($upload->getFileName(), $ubahNama);
     $namafile = $upload->getFileTo();
     $where = ' id_suratmasuk=' . $_POST['id'];
     $data = array('file' => $namafile);
     if ($upload->uploadFile()) {
         $this->model->uploadFile($data, $where);
         $datastat = array('stat' => '14');
         @Session::createSession();
         $user = Session::get('user');
         $log = new Log();
         $log->addLog($user, 'UPLOAD', 'user ' . $user . ' upload file surat no agenda ' . $this->model->getNomorAgenda($_POST['id']) . ' file:' . $namafile);
         unset($log);
         $this->model->update('suratmasuk', $datastat, $where);
         //update status -> pelaksana
         echo "<div id=success>Upload file berhasil</div>";
     } else {
         echo "<div id=error>Upload file berhasil</div>";
     }
     //        return true;
     //header('location:'.URL.'suratmasuk');
 }
开发者ID:ryderonil,项目名称:sisurip,代码行数:31,代码来源:suratmasuk_controller.php

示例5: ubahLampiran

 public function ubahLampiran()
 {
     $id_lamp = $_POST['id'];
     $id_surat = $_POST['id_surat'];
     $tgl = $_POST['tanggal'];
     $jns = $_POST['jenis'];
     $tipe = $_POST['tipe'];
     $nomor = $_POST['nomor'];
     $asal = $_POST['asal'];
     $hal = $_POST['hal'];
     $ket = $_POST['keterangan'];
     //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan)
     if ($_FILES['upload']['name'] != '') {
         $upload = new Upload('upload');
         $upload->setDirTo('arsip/');
         $ubahNama = array($tipe, $nomor);
         $upload->setUbahNama($ubahNama);
         $upload->changeFileName($upload->getFileName(), $ubahNama);
         $namafile = $upload->getFileTo();
     } else {
         $filex = $_POST['file'];
         $file = explode("_", $filex);
         $j = count($file);
         $ext = explode('.', $file[$j - 1]);
         //            var_dump($ext);
         //            var_dump($file);
         //            $namafile = explode("_", $file);
         //            var_dump($namafile);
         $file[0] = $tipe;
         $namafile = '';
         for ($i = 0; $i < $j - 1; $i++) {
             $namafile .= '_' . $file[$i];
             echo $file[$i] . '</br>';
         }
         $namafile = trim($namafile, "_") . '_' . $ext[0] . '.' . $ext[1];
         //            var_dump($namafile);
         //            $namafile = implode("_", $namafile);
         rename('arsip/' . $filex, 'arsip/' . $namafile);
     }
     //$upload->init('upload');
     $lamp = new Lampiran_Model();
     $lamp->set('id_lamp', $id_lamp);
     $lamp->set('jns_surat', $jns);
     $lamp->set('id_surat', $id_surat);
     $lamp->set('tipe', $tipe);
     $lamp->set('nomor', $nomor);
     $lamp->set('tanggal', $tgl);
     $lamp->set('asal', $asal);
     $lamp->set('hal', $hal);
     $lamp->set('keterangan', $ket);
     $lamp->set('file', $namafile);
     /*$data = array(
           'jns_surat'=>$jns,
           'id_surat'=>$_POST['id'],
           'tipe'=>$tipe,
           'nomor'=>$nomor,
           'tanggal'=>  Tanggal::ubahFormatTanggal($_POST['tanggal']),
           'hal'=>$_POST['hal'],
           'asal'=>$asal,
           'keterangan'=>$_POST['keterangan'],
           'file'=>$namafile//upload belom diurus
       );*/
     //var_dump($data);
     if ($lamp->editLampiran()) {
         if ($_FILES['upload']['name'] != '') {
             $upload->uploadFile();
         }
         echo "<div id=success>Ubah data lampiran berhasil</div>";
     } else {
         echo "<div id=error>Ubah data lampiran gagal!</div>";
     }
     /*if($jns=='SM'){
           header('location:'.URL.'suratmasuk/detil/'.$data['id_surat']);
       }elseif ($jns=='SK') {
           header('location:'.URL.'suratkeluar/detil/'.$data['id_surat']);
       }*/
     //        return true;
 }
开发者ID:ryderonil,项目名称:sisurip,代码行数:78,代码来源:lampiran_controller.php


注:本文中的Upload::getFileTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。