Codeigniter: MP4 Video Upload not working(Codeigniter:MP4 视频上传不起作用)
问题描述
我正在研究一个问题很长时间,但仍然找不到任何解决方案.
I am researching on a problem for long time but still could not find any solution.
我正在使用 codeigniter 上传 mp4 文件.在此之前,我在 config/mimes.php 中为 mp4 添加了 mime 类型.我都试过了:mp4 =>视频/mp4
和mp4 =>array('video/mp4', 'video/3gpp')
I am uploading mp4 file using codeigniter.
Before that I added mime type for mp4 in config/mimes.php.
I tried both: mp4 => video/mp4
and
mp4 => array('video/mp4', 'video/3gpp')
这两种方法在本地服务器上都很完美,但是每当我在 Live 服务器上测试它时,它总是给出相同的错误消息不允许您尝试上传的文件类型.".
Both of these works perfect in Local server but whenever I test this on the Live server then It always give the same error message "The filetype you are attempting to upload is not allowed.".
我又尝试了一件事.IE.$config['allowed_types'] = "*";
I tried one more thing. i.e.
$config['allowed_types'] = "*";
它在本地和在线服务器上都能完美运行.
It works perfect in both local and online server.
但我只想要 mp4 视频类型.
But I want just mp4 video type.
有人有解决这个奇怪问题的办法吗?
Anybody have some solution for this strange problem?
推荐答案
终于我的问题得到了解决,所以我正在写这个答案.
Finally I got solution of my Problem so I am writing this answer.
本地和在线服务器中的大多数 MIME 类型检测是不同的.
Mostly detection of mime types in local and online server are different.
在我的例子中,本地服务器将 file_type 设置为video/mp4".但在线服务器将 mime 类型检测为application/octet-stream".
所以我在我的配置文件夹的 mime 类型列表中添加了数组:
So I added both in array in the mime type list in my config folder:
'mp4' =>array('video/mp4', 'application/octet-stream'),
现在它可以在本地和在线服务器上完美运行.
Now it works perfectly in both local and online server.
这篇关于Codeigniter:MP4 视频上传不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Codeigniter:MP4 视频上传不起作用


基础教程推荐
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01