0

I getting error while uploading csv file to live server. But it was working fine in same setup on localhost. Same code is working with jpg format.

ERROR-: The filetype you are attempting to upload is not allowed.

Controller-:

$config['upload_path'] = './assets/uploads/csv_importing/';
$config['allowed_types'] = 'csv|jpg';
$this->load->library('upload', $config);

// If upload failed, display error
if (!$this->upload->do_upload()) {
    $this->session->set_flashdata('success', $this->upload->display_errors());
    redirect('admin/import_user_csv');
} else {
    echo "file uploaded";
    die();
}
Saty
  • 22,443
  • 7
  • 33
  • 51
Vipul sharma
  • 1,245
  • 1
  • 13
  • 33
  • Which CI version you are using? – Tomasz Aug 27 '15 at 12:24
  • Check this topic: http://stackoverflow.com/questions/7495407/uploading-in-codeigniter-the-filetype-you-are-attempting-to-upload-is-not-allo – Tomasz Aug 27 '15 at 12:28
  • You should try this answer: [http://stackoverflow.com/questions/10078885/codeigniter-the-filetype-you-are-attempting-to-upload-is-not-allowed#answer-17791400][1] [1]: http://stackoverflow.com/questions/10078885/codeigniter-the-filetype-you-are-attempting-to-upload-is-not-allowed#answer-17791400 – Vali S Aug 27 '15 at 12:30

1 Answers1

0

added/replaced the following line to the mime types file application/config/mimes.php

'csv'   =>  array('application/vnd.ms-excel', 'text/anytext', 'text/plain', 'text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel')
Saty
  • 22,443
  • 7
  • 33
  • 51