主要參考連結:
[整理] 安裝 attach mod 相關問題與解法
[教學] attach_mod_v237 成功安裝法分享
附加檔案突破 2MB 限制
[解決] (論壇語系 utf-8 編碼) 下載附件_中文檔名變亂碼的問題
狀況描述:
問題一:
參考以上文章,已成功將attach mod(UTF-8)安裝好,使用目前正常(可正常上傳及下載),唯獨若附件有中文檔名時,則檔名有中文的部份會變成空白,並不是變成亂碼,但還是參考此文章修改
[問題]attach_mod241加上bb2019下載附件變成亂碼<暫時解決>
如下:
卻發現我的download.php中需修改的片段文字不同,我的download.php是:打開 download.php
找到取代代碼:
// Send out the Headers
header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $real_filename . '"');
header('Content-Disposition: inline; filename="' . $real_filename . '"');代碼:
// Send out the Headers
if($browser_agent == 'ie') {
header('Content-Type: ' . $attachment['mimetype'] . '; name="' . urlencode($real_filename) . '"');
header('Content-Disposition: inline; filename="' . urlencode($real_filename) . '"');
} else {
header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $real_filename . '"');
header('Content-Disposition: inline; filename="' . $real_filename . '"');
}
// Send out the Headers
header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $real_filename . '"');
header('Content-Disposition: attachment; filename="' . $real_filename . '"');
嘗試如下:
1.在不考慮文字不同的情況下,依照wasabi大大所言,將需修改部份取代之後,問題仍沒有解決,中文檔名的部份一樣是空白。
2.將需修改片段文字不同的地方(也就是inline)改成attachment,但問題還是一樣。
請問到底要怎麼改呢?
問題二:
後來經測試後發現附加檔案的中文檔名前面如果加上英文字(如檔名為:YH中文檔案),則中文字部份奇蹟似的正常了,所以若此問題無法解決的話,若能預設在附加檔案前面加上英文字則此檔名中文空白問題可暫時解決,因此欲參考jeswang.tw大大在此篇文章[問題]Att MOD 無法附加具有雙字元檔名回覆的文字修改
當使用EmEditor欲開啟attachmod\posting_attachments.php來編輯時,為了解決上傳檔為中文檔名問題,我發覺中文檔名前為英文或是數字,中文檔名就不會成為亂碼,所以我更改以下就強制掛上前置字元,也解決後面中文問題。
[quote]代碼:
用 EmEditor 開啟 attachmod\posting_attachments.php
找到
$r_file = trim(basename(htmlspecialchars($this->filename)));
改成
$r_file = trim(basename(htmlspecialchars('PHPBB_'.$this->filename)));
即可
卻跳出若編輯會有錯誤的訊息:
some characters cannot be converted using the specified encoding.The file will be corrupted if you continue editing and save the file.
嘗試忽略此訊息,將此檔依照jeswang.tw大大所言修改後,論壇會發生如下錯誤訊息:
Parse error: parse error, unexpected ',' in C:\AppServ\www\phpBB2\attach_mod\posting_attachments.php on line 1201
我想是因為修改此檔的原因,我也使用過記事本編輯posting_attachments.php,但出現的錯誤一樣。
請問要怎麼辦呢?
不好意思,寫了那麼長,希望有人可以撥空幫忙看一下。
補充:
目前安裝的外掛有Calendar Lite v1.4.7