CodeIgniter Forums
Can't Upload Different File Types - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Can't Upload Different File Types (/showthread.php?tid=51944)

Pages: 1 2


Can't Upload Different File Types - El Forum - 05-23-2012

[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?


Can't Upload Different File Types - El Forum - 05-23-2012

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


Can't Upload Different File Types - El Forum - 05-24-2012

[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


Can't Upload Different File Types - El Forum - 05-24-2012

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




Can't Upload Different File Types - El Forum - 05-24-2012

[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?


Can't Upload Different File Types - El Forum - 05-24-2012

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


Can't Upload Different File Types - El Forum - 05-24-2012

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


Can't Upload Different File Types - El Forum - 05-24-2012

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


Can't Upload Different File Types - El Forum - 05-24-2012

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



Can't Upload Different File Types - El Forum - 05-25-2012

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