codeigniter 上传 3gp 或 mp4 文件不起作用

发布于 2024-11-28 00:37:28 字数 583 浏览 2 评论 0原文

您好,我正在尝试在代码点火器上上传 3gp 和 mp4 文件,但它不起作用,

使用相同的代码可以很好地上传 mpg 文件,任何人都可以帮助我,我真的很感激,

这是我正在使用的代码

            $config = array(

               'allowed_types' => 'mp4|mp4|3gp|mpg';
               'file_name'     => 'video',
               'max_size'      => 1000,
               'upload_path'   => realpath(APPPATH.'../user_uploads/'),
                            );

            $this->load->library('upload',$config);

            $this->upload->do_upload();


            $user_upload = $this->upload->data();

hi I am trying to upload 3gp and mp4 files on code igniter and it doesnt work

the mpg files are uploaded fine using the same code could anyone help me with that I will really appreciate that

Here is the code i am using

            $config = array(

               'allowed_types' => 'mp4|mp4|3gp|mpg';
               'file_name'     => 'video',
               'max_size'      => 1000,
               'upload_path'   => realpath(APPPATH.'../user_uploads/'),
                            );

            $this->load->library('upload',$config);

            $this->upload->do_upload();


            $user_upload = $this->upload->data();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

节枝 2024-12-05 00:37:28

只需在 config/mimes.php 文件中添加您的 mime 类型即可。就像 3gp 一样:

'3gp'=>'video/3gpp'

可用的 mime 类型列表: http ://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

Just add your mime type in the config/mimes.php file. Like for 3gp:

'3gp'=>'video/3gpp'

List of available mime types : http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

橘虞初梦 2024-12-05 00:37:28

application/config/mimes.php

'3gp' => array(
    'video/mp4', 
    'video/3gp', 
    'video/3gpp', 
    'video/x-3gp', 
    'flv-application/octet-stream', 
    'application/octet-stream', 
    'inode/x-empty'
),
'mp4' => array(
    'video/mp4', 
    'video/3gpp',
    'application/octet-stream'
),

application/config/mimes.php

'3gp' => array(
    'video/mp4', 
    'video/3gp', 
    'video/3gpp', 
    'video/x-3gp', 
    'flv-application/octet-stream', 
    'application/octet-stream', 
    'inode/x-empty'
),
'mp4' => array(
    'video/mp4', 
    'video/3gpp',
    'application/octet-stream'
),
雪落纷纷 2024-12-05 00:37:28

在以下文件

application/config/mimes.php$mimes 数组中添加 .3gp 的 mime 类型

'3gp'   =>  array('video/3gpp', 'video/x-3gp', 'flv-application/octet-stream', 'application/octet-stream')

add mime type for .3gp in $mimes array in below files

application/config/mimes.php

'3gp'   =>  array('video/3gpp', 'video/x-3gp', 'flv-application/octet-stream', 'application/octet-stream')
撩起发的微风 2024-12-05 00:37:28

您必须设置允许上传的文件类型

 $config = array(
               'file_name'     => 'video',
               'max_size'      => 1000,
               'allowed_types'] = 'mp4|mp4|3gp'
               'upload_path'   => realpath(APPPATH.'../user_uploads/'),
                );

,并且如果您在 upload cofig 中输入的 mime 类型在 /config/mimes.php 中不存在。也将其添加到那里

You have to set the allowed types of files which can be uploaded

 $config = array(
               'file_name'     => 'video',
               'max_size'      => 1000,
               'allowed_types'] = 'mp4|mp4|3gp'
               'upload_path'   => realpath(APPPATH.'../user_uploads/'),
                );

and if the mime type you put in upload cofig doesn't exist in /config/mimes.php . add it there also

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文