Photo upload CodeIgniter

允我心安 提交于 2019-12-04 05:50:19

问题


When I upload a photo using CodeIgniter, the name of the image is changed to a random name like "107fb08f4a11cc37a040237cdcf0e48a.jpg" for example. I am having trouble showing the image from the database in the view because it is showing the original upload name and not the new name. How do I disable the function that changes this name?

These are the config settings:

$config = array(
    'upload_path'   => './uploads/',
    'allowed_types' => 'gif|jpg|png',
    'max_size'  => '6000',
    'max_width' => '2068',
    'max_height'    => '1032',
    'encrypt_name'  => true,
);

回答1:


change :

'encrypt_name'  => true,

to:

'encrypt_name'  => false,



回答2:


Change the

encrypt_name = "false"

Also remember that if this option is set to false then by default the codeigniter framework make the duplicate copies of the filename that are uploaded to the server by adding the integer value in front of the filename. In case you dont want duplicated files on the server, please set the overwrite option to true.

overwrite = true


来源:https://stackoverflow.com/questions/8539726/photo-upload-codeigniter

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