Пример #1
0
    echo "\n            <script type='text/javascript'>\n                window.parent.window.something_wrong_upload(\"" . $what_is_wrong . "\");\n            </script>\n        ";
}
function debug($what_is_wrong)
{
    echo "\n            <script type='text/javascript'>\n                window.parent.window.debug(\"" . $what_is_wrong . "\");\n            </script>\n        ";
}
function success()
{
    echo "\n            <script type='text/javascript'>\n                window.parent.window.success_upload();\n            </script>\n        ";
}
$scan_sk = $_FILES["scan_sk"];
$id_surat = $_POST["id_surat"];
if ($scan_sk["tmp_name"] == "") {
    something_wrong("Pilih file yang akan diupload");
} else {
    if (strtolower(ekstensi($scan_sk["name"])) != "pdf") {
        something_wrong("Maaf, file yang diupload harus berformat PDF");
    } else {
        $path = "../../sk_uploaded/cuti/";
        $nama_file_baru = "sk_cuti_" . $id_surat . ".pdf";
        move_uploaded_file($scan_sk["tmp_name"], $path . $nama_file_baru);
        //echo($scan_sk["tmp_name"] . "<br />");
        //echo($path . $nama_file_baru . "<br />");
        // EDIT DATA SCAN SK PADA TABLE SK DAN RIWAYAT CUTI
        $sql_edit_1 = "UPDATE tbl_sk_cuti SET scan_sk='" . $nama_file_baru . "' WHERE id_surat='" . $id_surat . "'";
        $sql_edit_2 = "UPDATE tbl_riwayat_cuti SET scan_sk='" . $nama_file_baru . "' WHERE id_surat='" . $id_surat . "'";
        mysql_query($sql_edit_1);
        mysql_query($sql_edit_2);
        //echo($sql_edit_1 . "<br />" . $sql_edit_2);
        success();
    }
Пример #2
0
<?php

session_start();
include "../koneksi.php";
include "../fungsi.php";
$skp = $_FILES["skp"];
$penilaian = $_FILES["penilaian"];
$dp3 = $_FILES["dp3"];
$nama_file_skp = $skp["name"];
$nama_file_penilaian = $penilaian["name"];
$nama_file_dp3 = $dp3["name"];
if (strtolower(ekstensi($nama_file_skp)) != "pdf" && $nama_file_skp != "" || strtolower(ekstensi($nama_file_penilaian)) != "pdf" && $nama_file_penilaian != "" || strtolower(ekstensi($nama_file_dp3)) != "pdf" && $nama_file_dp3 != "") {
    header("location:../../?mod=upload_dp3_proses&id=" . $_POST["id_skp"] . "&err_msg=Ekstensi file yang di upload harus PDF");
} else {
    // PROSES UPLOAD SKP
    if ($skp["tmp_name"] != "") {
        $handle_skp = fopen($skp["tmp_name"], "r");
        $bacafile_skp = fread($handle_skp, filesize($skp["tmp_name"]));
        $hex_skp = $bacafile_skp;
        fclose($handle_skp);
    }
    // PROSES UPLOAD PENILAIAN
    if ($penilaian["tmp_name"] != "") {
        $handle_penilaian = fopen($penilaian["tmp_name"], "r");
        $bacafile_penilaian = fread($handle_penilaian, filesize($penilaian["tmp_name"]));
        $hex_penilaian = $bacafile_penilaian;
        fclose($handle_penilaian);
    }
    // PROSES UPLOAD DP3
    if ($dp3["tmp_name"] != "") {
        $handle_dp3 = fopen($dp3["tmp_name"], "r");
<?php

session_start();
include "../koneksi.php";
include "../fungsi.php";
$file = $_FILES["file"];
$tipe_fd = $_POST["tipe_fd"];
$id_file = $_POST["id_file"];
$judul = $_POST["judul"];
$type = $file["type"];
$file_name = $file["name"];
$ekstensi = ekstensi($file_name);
$keterangan = $_POST["keterangan"];
$source = $_FILES['file']['tmp_name'];
$dest = "../../sys_files/file_upload/" . $file_name;
if ($id_file == "0" && $file["tmp_name"] != "") {
    $query = mysql_query("INSERT INTO tbl_file_download VALUES(null, '{$judul}', '{$file_name}', '{$ekstensi}', '{$keterangan}', CURDATE(), '{$tipe_fd}')") or die(mysql_error());
    if ($query) {
        // process upload file
        move_uploaded_file($source, $dest);
        header("location:../../?mod=file_download_adm&tipe_fd=" . $tipe_fd);
    }
} else {
    if ($id_file == "0" && $file["tmp_name"] == "") {
        header("location:../../?mod=file_download_adm_tambah&tipe_fd=" . $tipe_fd . "&id_file=" . $id_file . "&err=Tidak ada file yang diupload atau ukuran file lebih besar dari kapasitas maksimum");
    } else {
        if ($id_file != "0" && $file["tmp_name"] != "") {
            // cek jika masih ada file yang tersimpan
            if (file_exists($dest)) {
                unlink($dest);
                // hapus dahulu baru di upload kembali
Пример #4
0
$id_agama_pasangan = $_POST["id_agama_pasangan"];
$no_sk = $_POST["no_sk"];
$tgl_sk = $_POST["tgl_sk"];
$pejabat_sk = $_POST["pejabat_sk"];
$tgl_tidak_rujuk_lagi = $_POST["tgl_tidak_rujuk_lagi"];
$tgl_tidak_serumah_lagi = $_POST["tgl_tidak_serumah_lagi"];
$scan_sk = $_FILES["scan_sk"];
if ($nama_pasangan == "" || $pekerjaan_pasangan == "" || $id_agama_pasangan == "0" || $no_sk == "" || $tgl_sk == "" || $pejabat_sk == "") {
    something_wrong("Maaf, input anda belum lengkap");
} else {
    if ($scan_sk["tmp_name"] == "") {
        something_wrong("File scan SK harus diupload");
    } else {
        $nama_file_asli = $scan_sk["name"];
        $tmp_file_asli = $scan_sk["tmp_name"];
        if (strtolower(ekstensi($nama_file_asli)) != "pdf") {
            something_wrong("Maaf, file yang diupload harus berformat PDF");
        } else {
            // find the id_pegawai from the id_usulan
            $ds_usulan = mysql_fetch_array(mysql_query("SELECT * FROM tbl_usulan_cerai WHERE id_usulan='" . $id_usulan . "'"));
            $id_pegawai = $ds_usulan["id_pegawai"];
            $folder_path = "../../sk_uploaded/cerai/";
            // find the right filename in order to avoid
            // overwritting the file with the same name
            $urut = 1;
            while (file_exists($folder_path . "cerai_" . $id_pegawai . "_" . $urut . ".pdf")) {
                $urut++;
            }
            $nama_file_baru = "cerai_" . $id_pegawai . "_" . $urut . ".pdf";
            // copying the uploaded file to the website folder
            move_uploaded_file($tmp_file_asli, $folder_path . $nama_file_baru);