$date = @mysql_real_escape_string($_POST['date']); $jenis = @mysql_real_escape_string($_POST['jenis']); $name = @mysql_real_escape_string($_POST['name']); $kredit = @mysql_real_escape_string($_POST['kredit']); $memo = @mysql_real_escape_string($_POST['memo']); $id = @mysql_real_escape_string($_POST['id']); $old = @mysql_real_escape_string($_POST['old']); $stat_file = @mysql_real_escape_string($_POST['stat_file']); $name_file = @mysql_real_escape_string($_POST['name_file']); if ($stat_file == 0) { hapus_img($name_file); $name_file = ''; } if (!empty($_FILES['file']['name'])) { hapus_img($name_file); $up = new up(); $proses = $up->upload('file', '5', 'jpg|png|gif', '../../../vendor/dist/file/')->resize(200, 200)->return_name; if ($proses) { $name_file = $proses; } } $jenis = empty($jenis) ? 0 : $jenis; $mmo = array('file' => $name_file, 'memo' => $memo); $did = $sql->db_Update("transaksi", "\t`date`='{$date}',\n\t\t\t\t\t\t`name`='{$name}',\n\t\t\t\t\t\t`jenis`='{$jenis}',\n\t\t\t\t\t\t`jml`='{$kredit}',\n\t\t\t\t\t\t`memo`='" . json_encode($mmo) . "' WHERE id='{$id}' AND type=2"); if ($did) { if ($kredit > $old) { $total = $kredit - $old; $meta = $sql->db_Update("meta", "`value`=`value`+{$total} WHERE `type`=2"); } elseif ($old > $kredit) { $total = $old - $kredit; $meta = $sql->db_Update("meta", "`value`=`value`-{$total} WHERE `type`=2");
<?php include 'upload.php'; if (!empty($_POST['submit'])) { $upl = new up(); $upl->upload('upl', '5', 'jpg', 'uploads/')->resize(200, 200); } /** Readme */ /* untuk upload file ================= $upl->upload(nama_var_post, max_size, format_yang_didukung, lokasi_penyimpanan) ket : nama_var_post : name dari input type file yang digunakan misal saya menggunakan <input name="upl" type="file"/> maka nama_var_post adalah upl max_size : ukuran file maksimal yang bisa du upload (satuan ukur dalam Mb) format_yang_didukung : jika hanya ingin upload image maka gunakan jpg , jika dapat mendukung beberapa jenis file maka gunakan jpg | pdf | dll | :D lokasi_penyimpanan : tempat nyimpan file :D misal : // max size 5 Mb, format yang didukung jpg sama png $upl->upload('upl', '5', 'jpg | png', 'uploads/') resize file ============== $upl->resize(width, height);