Upload file type

百般思念 提交于 2020-01-07 02:24:19

问题


I've created an upload file and it won't save in database. I created the controller and the view like codeigniter tutorial says.

I put in the config the allowed_types.

 $config['allowed_types'] = 'gif|jpg|png|jpeg';

and it continues to show me this:

 The filetype you are attempting to upload is not allowed.

What should I do?


回答1:


This is an issue that occurs in CodeIgniter 2.1.0 and PHP v5.2.x. If you downgrade back to CodeIgniter 2.0.3, the upload problem should go away.




回答2:


Replace your system/libraries/Upload.php with this one:

https://raw.github.com/narfbg/CodeIgniter/320ddaa3d01c9d8ee6832fa25f9273e2588c63dd/system/libraries/Upload.php

This is a new version of the Upload class that's currently waiting to be merged - it should fix any issue that you might have with file detection on upload.



来源:https://stackoverflow.com/questions/8835764/upload-file-type

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!