• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't Upload Different File Types

So I am fairly new to Codeigniter and I am trying to use the File Uploading class. I followed the the tutorial on Nettuts and it works but only for image file types. So jpg, png and gif all work. The issue is I am trying to upload Font files like ttf and otf. When I change the $config['allowed_types'] to allow ttf and otf it still does not work. Is there something I am missing or does Codeigniter only allow image file types to be uploaded?

You need to add the proper mime type to config/mimes.php. You also need to check your server to see if it has the mime types setup.

mime types should be ok.

They've set the config types explicit in gallery_model.php. Change the code in the function do_upload() and it will work as you wish

[eluser]Pinki Naskar[/eluser]
I am also facing the same problem at the time of uploading video file with extension mp4.

I have set $config['allowed_types'] as
$config['allowed_types'] = 'avi|mpeg|mp4|3gp';

But it doesn't work....It shows error file type is not allowed.

Now you have to check the mime types Smile Don't know if these are in there. Did the fix in gallery_model fix your problem with font files?

I changed the allowed types in the gallery_model but it still does not work. As for the mime types I can't seem to find the proper mime type to use for fonts.

I fixed my issue! I was able to find the answer. I added this to the config/mimes.php file:

'ttf' => 'application/octet-stream'

I did the same for otf. The files were then able to be uploaded.

[eluser]Pinki Naskar[/eluser]
It works .....thank u.

Webmaster toolkit - Mime Types

^ That is a really good resource link for mime types. I didn't see ttf or otf on there though so it looks like it might not have everything but still really good.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.