欧美日韩国产精选国产永久在线入口|久久精品无码av色色丁香婷婷五月|欧美伊人网91天天视频色板一区|啪啪激情五月天国产高清一卡二卡|激情五月天丁香高清有码无码中文|高清无码免费在线看免费黄片|蜜桃亚洲 无码二区三区黄色网|人人叉人人爽日美黄色视频

新聞中心

PHPCMSV9上傳附件錯(cuò)誤提示信息為空白

作者 / 無(wú)憂主機(jī) 時(shí)間 2014-03-27 17:54:48

關(guān)于phpcmsV9后臺(tái)上傳圖片出錯(cuò)的問(wèn)題,之前無(wú)憂主機(jī)小編也遇到過(guò)類似的,但是這次完全是沒(méi)有提示的錯(cuò)誤,直接彈出一個(gè)空白的對(duì)話框,如下圖所示:   [caption id="attachment_13734" align="alignnone" width="540"]phpcms后臺(tái) phpcms后臺(tái)[/caption] 這種的毫無(wú)提示,連報(bào)錯(cuò)都讓人一頭霧水。一開(kāi)始發(fā)現(xiàn)系統(tǒng)在其它服務(wù)器上運(yùn)行ok,以為是這臺(tái)服務(wù)器的問(wèn)題,所以一直把精力放到服務(wù)器的環(huán)境配置上了,比如上傳大小限制,上傳的目錄權(quán)限,網(wǎng)站文件夾的權(quán)限設(shè)置。后來(lái)發(fā)現(xiàn)問(wèn)題是看到php的錯(cuò)誤日志,定位到錯(cuò)誤發(fā)生在移動(dòng)臨時(shí)上傳文件到保存目錄的地方,路徑中多了一條下劃線。 然后才找到這段離奇的代碼

$temp_filename = $this->getname($fileext);

$savefile = $this->savepath.$temp_filename;

$savefile = preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $savefile);

$filepath = preg_replace(new_addslashes("|^".$this->upload_root."|"), "", $savefile);

if(!$this->overwrite && file_exists($savefile)) continue;

$upload_func = $this->upload_func;

if(@$upload_func($file['tmp_name'], $savefile)) {

$this->uploadeds++;

@chmod($savefile, 0644);

@unlink($file['tmp_name']);

$file['name'] = iconv("utf-8",CHARSET,$file['name']);

$uploadedfile = array('filename'=>$file['name'], 'filepath'=>$filepath, 'filesize'=>$file['size'], 'fileext'=>$fileext, 'fn'=>$file['fn']);

$thumb_enable = is_array($thumb_setting) && ($thumb_setting[0] > 0 || $thumb_setting[1] > 0 ) ? 1 : 0;

$image = new image($thumb_enable,$this->siteid);

if($thumb_enable) {

$image->thumb($savefile,'',$thumb_setting[0],$thumb_setting[1]);

}

if($watermark_enable) {

$image->watermark($savefile, $savefile);

}

$aids[] = $this->add($uploadedfile);

}
    這個(gè)程序員哥哥的意圖是對(duì)非法的文件擴(kuò)展名進(jìn)行安全過(guò)濾,但發(fā)生一件很碉堡的事情,就是把整個(gè)路徑給進(jìn)行了過(guò)濾。 $savefile=preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $savefile); 這段屏蔽代碼的意識(shí)就是把帶有php/jsp/asp......等等字樣的路徑去除,所以哪位仁兄剛好域名是帶PHP ,asp等的,就有可能會(huì)出現(xiàn)這個(gè)狀況的報(bào)錯(cuò),而無(wú)憂主機(jī)剛好是,所以結(jié)果就是域名被屏蔽了,當(dāng)然圖片找不到保存的路徑了。 解決辦法很簡(jiǎn)單。注釋掉這行或者改成下面的代碼 $temp_filename = $this->getname($fileext); $temp_filename = preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $temp_filename); $savefile = $this->savepath.$temp_filename;   相關(guān)文章推薦閱讀: 解決PHPCMSV9網(wǎng)站更換域名后無(wú)法上傳圖片 PHPCMS V9.42版本上傳圖片出現(xiàn)UNDEFINED解決辦法 PHPCMS后臺(tái)上傳圖片成功但實(shí)際并未上傳的解決辦法  

本文地址:http://www.love62.cn/phpcms/13733.html

1
1
1
1
1
1
1

客戶服務(wù)熱線

0791-8623-3537

在線客服