後臺上傳商品圖片的時候,如果你選擇一個中文名稱的圖片,那麼上傳後會產生亂碼,導致圖片顯示不出來。

下面說一種解決辦法:
使用“年月日時分秒 + 6個隨機字元”做為檔案名,如 20101016135632jusv3x.jpg

打開文件 \includes\fckeditor\editor\filemanager\connectors\php\commands.php
找到
$sFileName = $oFile['name'] ;

修改為

$string = 'abcdefghijklmnopqrstuvwxyz0123456789';
  $rand = '';
  for ($x=0;$x<6;$x++){
   mt_srand();
   $rand.= substr($string,mt_rand(0,strlen($string)-1),1);
  }
  $sFileName = date('YmdHis').$rand.".".strtolower(array_pop(explode(".",$oFile['name'])));

arrow
arrow
    全站熱搜

    Jump 發表在 痞客邦 留言(0) 人氣()