| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/wamp/www/SIPBOS_2020/application/modules/pemda/controllers/ |
Upload File : |
<?php
class Pemda extends Admin_Controller {
public function __construct()
{
parent::__construct();
$this->modul_name = 'pemda';
$this->modul_display = 'Data Pemda';
$this->view_form = 'pemda_form';
$this->load->model('pemda_model', 'data_model');
}
public function index()
{
$data = array();
$data['modul'] = $this->modul_name;
$data['modul_display'] = $this->modul_display;
$data['data'] = $this->data_model->get_data_pemda();
$data['main_content'] = $this->view_form;
$this->load->view('layout/template_admin', $data);
}
public function proses()
{
$success = $this->data_model->update_data();
if($success){
$response->isSuccess = TRUE;
$response->message = 'Data berhasil diperbaharui';
$response->sql = $this->db->queries;
}
else
{
$response->isSuccess = FALSE;
$response->message = 'Data gagal diperbaharui';
$response->error = $this->data_model->last_error_message;
$response->sql = $this->db->queries;
}
echo json_encode($response);
}
public function logo()
{
$this->db->select('LOGO');
$logo = $this->db->get('PEMDA');
$result = $logo->result_array();
$image = $this->db->get_blob($result[0]['LOGO']);
if ($logo->num_rows() > 0)
{
header('Content-type: image/bmp');
echo $image;
}
}
public function simpan_logo($image=0)
{
$fileName = $_FILES['image']['name'];
$fileSize = $_FILES['image']['size'];
$fileError = $_FILES['image']['error'];
if($fileSize > 0 || $fileError == 0){
$move = move_uploaded_file($_FILES['image']['tmp_name'], 'uploads/tmp/'.$fileName);
$this->data_model->save_logo($image);
if($move)
{
$response->success = 'Upload berhasil!';
}
else
{
$response->success = 'Upload gagal!';
}
}else{
$response->success = 'Upload gagal!';
}
//echo json_encode($response);
$this->index();
redirect('pemda');
}
public function hapus_logo()
{
$this->data_model->delete_logo();
$this->index();
}
public function uploadtmp()
{
$data['action'] = $this->input->post('action');
if(count($_FILES)>0)
{
$config['upload_path'] = './uploads/tmp/';
$this->load->library('upload', $config);
$this->upload->initialize($config);
$ext = $this->upload->get_extension($_FILES['filefieldname']['name']);
$old_name = $_FILES['filefieldname']['name'];
$time_stamp = date('d.m.Y.H.i.s');
$new_name = $time_stamp.$ext;
$tmp_name = $_FILES['filefieldname']['tmp_name'];
if ( ! @move_uploaded_file($_FILES['filefieldname']['tmp_name'], $this->upload->upload_path.$new_name))
{
if ( ! @copy($_FILES['filefieldname']['tmp_name'], $this->upload->upload_path.$new_name))
{
$is_upload = FALSE;
}
else
{
echo 'upload';
}
}
else
{
?>
<script>
var str = '<li><a class="del_tmp" onclick="delete_tmp(this)"></a><input type="hidden" name="LOGO[]" value="<?php echo $new_name?>" ><input type="text" name="keterangan_logo[]" id="keterangan_logo" value="Keterangan" onfocus="fokus_ket_logo(this)" onblur="blur_ket_logo(this)" size="20"><a href="#" class="screenshot" id="logopemda" rel="<?php echo base_url()?>uploads/tmp/<?php echo $new_name?>"> <?php echo $old_name ?></a></li>';
parent.document.getElementById('photosxx').innerHTML+=str;
parent.screenshotPreview();
</script>
<?php
}
}
else
{
echo 'gagal';
}
}
}