When i try upload image files in localhost it stored on DB and i can read that uploaded images, but when i upload the code to the server via FTP it said error like this:
- This page isn’t working
- blablabal.com is currently unable to handle this request.
- HTTP ERROR 500
Is that because my php version in localhost is different with the PHP version on the server?
Can someone help me? Thanks mate
My controller
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class News extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('news_model');
$this->load->helper(array('form', 'url'));
$this->load->library('session');
}
public function index()
{
$data['datax'] = $this->news_model->tampil_data()->result();
$data['viewx']="news/content";
$this->load->view('template/header');
$this->load->view('template/main',$data);
//$this->load->view('news/content');
$this->load->view('template/footer');
}
function tambah(){
$data['title'] = "Tambah news";
$data['updateid'] = '';
$data['update'] = '';
$data['viewx']="news/form";
$this->load->view('template/header');
$this->load->view('template/main',$data);
//$this->load->view('news/content');
$this->load->view('template/footer');
}
function tambah_aksi(){
//upload
// $this->load->library('upload');
$this->load->library('upload');
$nmfile = "file_".time(); //nama file saya beri nama langsung dan diikuti fungsi time
$config['upload_path'] = './../assets/'; //path folder
$config['allowed_types'] = 'gif|jpg|png|jpeg|bmp'; //type yang dapat diakses bisa anda sesuaikan
$config['max_size'] = '2048'; //maksimum besar file 2M
$config['max_width'] = '1288'; //lebar maksimum 1288 px
$config['max_height'] = '768'; //tinggi maksimu 768 px
$config['file_name'] = $nmfile; //nama yang terupload nantinya
$this->upload->initialize($config);
if($_FILES['images']['name'])
{
if ($this->upload->do_upload('images'))
{
$gbr = $this->upload->data();
// $data = array(
// 'nm_gbr' =>$gbr['file_name'],
// 'tipe_gbr' =>$gbr['file_type'],
// 'ket_gbr' =>$this->input->post('textket')
//);
//akses model untuk menyimpan ke database
$data = array();
//insert
$judul = $this->input->post('judul');
$news = $this->input->post('news');
$imagess = $this->input->post('images');
$data = array(
'title' => $judul,
'detail' => $news,
'images' => $gbr['file_name']
);
$this->news_model->input_data($data,"news");
//pesan yang muncul jika berhasil diupload pada session flashdata
$this->session->set_flashdata("pesan", "<div class=\"col-md-12\"><div class=\"alert alert-success\" id=\"alert\">Upload gambar berhasil !!</div></div>");
redirect('news/'); //jika berhasil maka akan ditampilkan view vupload
}else{
//pesan yang muncul jika terdapat error dimasukkan pada session flashdata
$this->session->set_flashdata("pesan", "<div class=\"col-md-12\"><div class=\"alert alert-danger\" id=\"alert\">Gagal upload gambar !!</div></div>");
redirect('news/tambah'); //jika gagal maka akan ditampilkan form upload
}
}
}
i try change my php version and this is what i got
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function finfo_open()