代码:MP4视频上传不工作 [英] Codeigniter: MP4 Video Upload not working

查看:230
本文介绍了代码:MP4视频上传不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个问题很长时间,但仍然找不到任何解决方案。



我使用codeigniter上传mp4文件。
之前,我添加了mime类型的mp4在config / mimes.php。
我试过两个: mp4 => video / mp4

mp4 => array('video / mp4','video / 3gpp')



这两种工作在本地服务器上都很完美,但每当我在Live服务器上测试这个时,它总是给出相同的错误消息您正在尝试的文件类型不允许上传。



我尝试了另一件事。即
$ config ['allowed_types'] =*;



它在本地和在线服务器上都能正常工作。



但我只想mp4视频类型。



任何人都有这个奇怪的问题的解决方案?

解决方案

最后我得到了我的问题的解决方案,所以我写这个答案。





在本例中,本地服务器的文件类型为file_type为video / mp4。但是在线服务器检测到mime类型为application / octet-stream。



所以我在我的config文件夹中的mime类型列表中添加了两个数组: p>

'mp4'=> array('video / mp4','application / octet-stream'),



现在它在本地和在线服务器上都能正常工作。


I am researching on a problem for long time but still could not find any solution.

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')

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.".

I tried one more thing. i.e. $config['allowed_types'] = "*";

It works perfect in both local and online server.

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.

Mostly detection of mime types in local and online server are different.

In my case, Local server was getting file_type as "video/mp4". But online server was detecting the mime type as 'application/octet-stream'.

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.

这篇关于代码:MP4视频上传不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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