douyin7416 2012-07-13 05:25
浏览 30
已采纳

处理具有空格的文件名

My script here works fine:

image protection in codeigniter

However it displays a broken image if my filename has a space, so say it is "obama 1.jpg".

To try and resolve this problem, I have used http://php.net/manual/en/function.escapeshellarg.php

And replaced all the white spaces in the img_id with "%"s.

But I have had no luck. I cannot strip the white spaces out, so will have to make due with the structure of the string.

Thanks for your help.

  • 写回答

2条回答 默认 最新

  • du958642589 2012-07-13 06:29
    关注

    When you call the image just use

    echo urlencode($image_name);
    

    That should fix it!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部