Welcome Guest, Not a member yet? Register   Sign In
Why This CSVimport library don't run !!
#1

anyone can help me??
i have a library csv import for this link csvimport

and i have i controller :
class Csv extends CI_Controller {

function __construct() {
parent::__construct();
$this->load->model('csv_model');

}

function index() {
$data['table_upload'] = $this->csv_model->get_table_upload();
$this->load->view('csvindex', $data);
}

function importcsv($config) {
$data['table_upload'] = $this->csv_model->get_table_upload();
$data['error'] = ''; //kalau upload error
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'csv';
$config['max_size'] = '1000';
$this->load->library('upload', $config);



if (!$this->upload->do_upload()) {
$data['error'] = $this->upload->display_errors();
$this->load->view('csvindex', $data);
} else {
$file_data = $this->upload->data();
$file_path = './uploads/'.$file_data['file_name'];

if ($this->csvimport->get_array($file_path)) {
$csv_array = $this->csvimport->get_array($file_path);
foreach ($csv_array as $row) {
$insert_data = array(
'no_transaksi' =>$row['no_transaksi'],
'tgl_transaksi' =>$row['tgl_transaksi'],
'jatuh_tempo' =>$row['jatuh_tempo'],
'pelanggan' =>$row['pelanggan'],
'lokasi' =>$row['lokasi'],
'mata_uang' =>$row['mata_uang'],
'nilai_tukar' =>$row['nilai_tukar'],
'tipe_pembayaran' =>$row['tipe_pembayaran'],
'pembayaran_tem' =>$row['pembayaran_tem'],
'wiraniaga' =>$row['wiraniaga'],
'admin' =>$row['admin'],
'keterangan_transaksi' =>$row['keterangan_transaksi'],
'plu' =>$row['plu'],
'nama_barang' =>$row['nama_barang'],
'deskripsi_barang' =>$row['deskripsi_barang'],
'jumlah' =>$row['jumlah'],
'satuan' =>$row['satuan'],
'harga_barang' =>$row['harga_barang'],
'diskon' =>$row['diskon'],
'diskon_sub_total' =>$row['diskon_sub_total'],
'tax_sub_total' =>$row['tax_sub_total'],
'sub_total' =>$row['sub_total'],
'inv_diskon' =>$row['inv_diskon']
);
$this->csv_model->insert_csv($insert_data);
}
$this->session->set_flashdata('Berhasil', 'data telah di simpan');
redirect(base_url().'/csv');
echo "<pre>"; print_r($insert_data);
} else
//$data['error'] = "Error";
$this->load->view('csvindex', $data);
}

}

}

but, if i running,, i have error,, 404 not found?? i use codeigniter last ver.
Reply
#2

Please use a
Code:
[code]
block next time for pasting in code.

As for your issue, a 404 error is issued only when a controller, method, or both are not found, it does not have anything to do with a library. Could you provide more info, which URL you visit that you receive the error?
Reply
#3

(11-13-2014, 02:31 AM)slax0r Wrote: Please use a
Code:
[code]
block next time for pasting in code.

As for your issue, a 404 error is issued only when a controller, method, or both are not found, it does not have anything to do with a library. Could you provide more info, which URL you visit that you receive the error?

I agree, we need to know what caused the error.

I am not sure why you posted the files, I would not download them, as I have no idea what is inside them.

Please show us the code you used. If the code is PHP, you can use [ p h p] [ / p h p ] without all the spaces to format PHP code.
Reply
#4

404 .. maybe the input file oder the controller method isn't found. But as others said .. a detailed error message would be helpfull.

Reply
#5

You should also confirm how have you deployed CI on your web server?

Virtual Hosting under apache?
Subfolder?
CI Version which you are using?

Have you configured your .htaccess correctly?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB