Upload File CSV pada Codeigniter selalu Not Allowed File Type

Belum lama lagi coba upload file CSV pada codeigniter, saya menggunakan codeigniter v.2.1.3 di linux namun selalu not allowed file type. Penasaran ternyata ada yang tanya juga di stackoverflow šŸ˜€ dan ketemu.

Kita cukup mengganti mime type csv yang ada pada file mimes.php (application/config/mimes.php) yang awalnya :

1
2
3
4
5
6
7
8
9
10
11
12
'csv' =>  array(
  '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'
)

menjadi

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'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'
)

Setelah disimpan, ternyata jalan šŸ˜€
Catetan lumayan

Artikel lainnya

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: