I want to upload a .c file. I am using CodeIgniter. The code I am using is working for .pdf but whenever I try to upload a .c file it shows "The filetype you are attempting to upload is not allowed.".
My code is given below:
$config = array
(
'upload_path' => './solutions',
'allowed_types' => 'c',
'file_name' => $file_name,
'file_size' => 1000,
'remove_spaces' => 'true'
);
$this->upload->initialize($config);
When I write pdf in allowed types, it works, but not in the case of C.
In allowed_types you need to have MIME types.
For a c source file that would be "text/plain", since there is no "c" MIME type.
See http://en.wikipedia.org/wiki/Internet_media_type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With