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


PHP Upload::setDirTo方法代码示例

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


在下文中一共展示了Upload::setDirTo方法的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: uploadrev

 public function uploadrev()
 {
     $return = true;
     $notif = new Notifikasi();
     $id = $_POST['id'];
     $catatan = $_POST['catatan'];
     $user = $_POST['user'];
     //        var_dump($catatan);
     $time = date('Y-m-d H:i:s');
     $filename = '';
     $datas = $this->model->getSuratById($id, 'detil');
     //        foreach ($datas as $val){
     $filename = $datas->getFile();
     //        }
     //---------------------------------
     $fln = array();
     if (file_exists('arsip/temp/' . $filename)) {
         //jika file telah ada di folder temp/
         $temp = explode('.', $filename);
         //            var_dump($temp);
         $sql = "SELECT file FROM revisisurat WHERE file LIKE '{$temp['0']}%'";
         $file = $this->model->select($sql);
         //            var_dump($file);
         if (count($file > 0)) {
             if (count($file) == 1) {
                 $pisah = explode('.', $filename);
                 $nama = $pisah[0];
                 $ext = $pisah[1];
                 var_dump($ext);
                 $filename = $nama . '_1.' . $ext;
                 //                    var_dump($filename);
                 //                    break;
             } else {
                 foreach ($file as $val) {
                     $temp = explode('.', $val['file']);
                     $pisah = explode('_', $temp[0]);
                     if (count($pisah) <= 3) {
                         $fln[] = 0;
                     } else {
                         $fln[] = $pisah[3];
                     }
                     //                        $fln[] = explode('_', $temp[0]);
                     //                        var_dump($fln);
                     //                        $len = count($temp);
                     //                        $fln[] = (int) ($len-1); //mengambil array terakhir
                     $num = max($fln);
                     //                        var_dump($num);
                     $filename = $pisah[0] . '_' . $pisah[1] . '_' . $pisah[2] . '_' . ($num + 1) . '.' . $temp[1];
                     //                        var_dump($filename);
                 }
             }
         }
     }
     //-----------------------------------
     $data = array('id_surat' => $id, 'catatan' => $catatan, 'user' => $user, 'file' => $filename, 'time' => $time);
     $ext = explode(".", $filename);
     if ($ext[count($ext) - 1] == 'pdf') {
         //jika telah diupload tipe file pdf
         if (file_exists('arsip/' . $filename)) {
             copy('arsip/' . $filename, 'arsip/temp/' . $filename);
         }
         //copykan ke folder temp/
     } else {
         $upload = new Upload('upload');
         //jika tidak, upload file tersebut
         $upload->setDirTo('arsip/temp/');
         $upload->setFileTo($filename);
         $upload->uploadFile();
     }
     //upload file revisi
     //        $upl = $upload->uploadFile(); //upload dengan nama beda jika sudah terdapat file di arsip
     //        if(!$upl){
     //            $return = "Gagal upload! cek file dan ekstensi, ekstensi harus pdf, doc atau docx";
     //        }
     $role = Session::get('role');
     /*
      * alurnya klo revisi kasi->pelaksana
      * revisi kk -> kasi dan pelaksana :siiip
      * otak atik dari awak lagi, ternyata butuh field user/creator surat keluar yg berisi pelaksananya siapa
      */
     //var_dump($id);
     $notif->set('id_surat', $id);
     //cek lagi
     $notif->set('jenis_surat', 'SK');
     $notif->set('stat_notif', 1);
     $user = $this->model->getUser($id);
     //var_dump($user);
     $notif->set('bagian', $user[2]);
     if ($role == 1) {
         $dataks = $this->model->select("SELECT id_user FROM user WHERE role=2 AND bagian =" . $user[2] . " AND active='Y'");
         foreach ($dataks as $val) {
             $notif->set('id_user', $val['id_user']);
         }
         $notif->set('role', 2);
         //tambah notifikasi untuk kasi
         $notif->addNotifikasi();
     }
     $notif->set('id_user', $user[0]);
     $notif->set('role', $user[1]);
     //tambah notifikasi untuk pelaksana
//.........这里部分代码省略.........
开发者ID:ryderonil,项目名称:sisurip,代码行数:101,代码来源: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::setDirTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。