【问题标题】:codeingitor how to allow .bmp file to upload?codeingitor 如何允许 .bmp 文件上传?
【发布时间】:2020-11-25 09:04:23
【问题描述】:

我想允许上传 .bmp 文件格式

这是我的代码:

            $config = [];
            $config['file_name'] = $filename;
            $config['upload_path'] = $dir;
            $config['allowed_types'] = 'jpg|jpeg|png|gif|bmp|pdf';
            $config['max_size'] = '10000';

            $this->upload->initialize($config);               
            $fileData = $this->upload->data();

但是类似您尝试上传的文件类型不允许这样的错误。

【问题讨论】:

  • 签入config/mimes.php,如果你找到bmp,那么它应该可以工作
  • 是的,那里找到了我的文件
  • 哪个 PHP 版本?
  • PHP 版本 7.4.11

标签: php codeigniter-3


【解决方案1】:

你可以添加

$mimes = array('bmp' => array('image/bmp', 'image/x-windows-bmp', 'image/x-ms-bmp'))

在应用程序/config/mimes.php 中

【讨论】:

    猜你喜欢
    • 2023-03-11
    • 1970-01-01
    • 2018-10-16
    • 2013-01-29
    • 2011-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-28
    相关资源
    最近更新 更多