Codeigniter xml文件未上传 [英] Codeigniter xml file not uploading

查看:53
本文介绍了Codeigniter xml文件未上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在Codeigniter中上载XML文件时.我正在使用eFax,尝试设置入站传真传递:启用XML投递.每当我使用他们提供的Sample.xml文件进行测试后,都会收到以下错误消息:

When trying to upload an XML file in Codeigniter. I am working with eFax, trying to set up Inbound Fax Delivery: Enabling XML Posting. I am getting the following error anytime I do a test post using their Sample.xml file they have provided:

The filetype you are attempting to upload is not allowed.

其他文档可以上传.在我的上传配置中,在 allowed_types 的选项中设置了 xml :

Other documents will upload fine. In my upload config, xml is set in the options for allowed_types:

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

为什么Codeigniter不允许eFax XML文档类型?

Why does Codeigniter not allow the eFax XML document type?

推荐答案

我知道了为什么会这样.默认情况下,在Codeigniter的 mimes.php 配置文件中未设置MIME类型.我需要为 xml MIME添加多个MIME类型的数组.具体来说,我需要添加 application/xml .

I've figured out why this was happening. By default, the MIME type was not set in Codeigniter's mimes.php config file. I needed to add an array of multiple MIME types for the xml MIME. Specifically, I needed to add application/xml.

因此在/application/config/mimes.php 中,我更改了这一行:

So in /application/config/mimes.php I changed this line:

'xml' => 'text/xml',

为此(将 xml 选项转换为数组):

To this (converting the xml option to an array):

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

那立即解决了这个问题.

That fixed the problem right away.

这篇关于Codeigniter xml文件未上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆