2013-08-21 43 views
3

嘗試上傳Codeigniter中的XML文件時。我正在使用eFax,嘗試設置入站傳真傳送:啓用XML發送。我隨時使用他們提供的Sample.xml文件進行測試,發現以下錯誤:Codeigniter xml文件未上傳

The filetype you are attempting to upload is not allowed. 

其他文檔將正常上傳。在我上傳的配置,xml在選項設置爲allowed_types

$config['allowed_types'] = 'txt|xml'; 

爲什麼笨不允許數碼傳真XML文檔類型?

回答

5

我已經知道爲什麼會發生這種情況。默認情況下,在Codeigniter的mimes.php配置文件中未設置MIME類型。我需要爲xml MIME添加多個MIME類型的數組。具體來說,我需要添加application/xml

所以在/application/config/mimes.php我改變這一行:

'xml' => 'text/xml', 

向該(該xml選項轉換成一個數組):

'xml' => array('text/xml', 'application/xml'), 

即解決了這一問題的時候了。

0

這是我使用的一個:

'xml' => array('application/xml', 'text/xml', 'text/plain'), 

注:粘貼/application/config/mimes.php