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

#1
[eluser]drock[/eluser]
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?

#2
[eluser]pbflash[/eluser]
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.

#3
[eluser]Anonymous[/eluser]
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

#4
[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.


#5
[eluser]Anonymous[/eluser]
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?

#6
[eluser]drock[/eluser]
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.

#7
[eluser]drock[/eluser]
I fixed my issue! I was able to find the answer. I added this to the config/mimes.php file:

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

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

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

#9
[eluser]InsiteFX[/eluser]
Webmaster toolkit - Mime Types

#10
[eluser]drock[/eluser]
^ 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.