I'm using codeigniter upload class and I'm trying to upload a csv file.
Here is my PHP code :
public function upload(){
$config['upload_path'] = './csv/';
$config['allowed_types'] = 'csv';
$config['max_size'] = 10240;
$this->upload->initialize($config);
if (!$this->upload->do_upload('file')){
echo "<pre>";
print_r($this->upload->data());
echo "</pre>";
die();
$this->session->set_flashdata('upload_error', $this->upload->display_errors());
redirect('/Customers');
}else{
$this->session->set_flashdata('upload_success', 'Customer list successfully uploaded!');
redirect('/Customers');
}
}
when I upload my csv file I get :
Array
(
[file_name] => mayfile.csv
[file_type] => text/x-fortran
[file_path] => /home/public_html/....
[file_ext] => .csv
[file_size] => 7842
[is_image] =>
[image_width] =>
[image_height] =>
[image_type] =>
[image_size_str] =>
)
The type should be text/csv not text/x-fortran why is that happening?
This is a preview of the csv file data I have uploaded:
[
Thank you