PHP 版本是否会影响 MIME.php 在代码点火器中


does PHP version affect MIME.php in codeigniter

我正在使用codeigniter和 在我的本地主机中,我一直在使用PHP版本5.3.1。我的文件上传做得很好,没有任何错误,当我将其上传到服务器时,服务器中的PHP版本是5.3.18。当我上传文档时,我没有错误,但它没有上传到我指定的文件夹,我已经将文件夹设置为 777 状态。有什么建议我可以为我的文件上传做些什么吗?谢谢

编辑

$config['upload_path'] = './upload_documents/';
            $config['allowed_types'] = 'docx|xls|xlsx|pdf';
            $config['max_size'] = '0'; // 0 = no file size limit
            $config['max_width']  = '0';
            $config['max_height']  = '0';
            $config['overwrite'] = TRUE;
            $this->load->library('upload', $config);
            $this->upload->initialize($config);
            $this->upload->do_upload('userfile');
            $upload_result = $this->upload->data('userfile');

这是我的上传文件格式,与我的本地主机相同,它在本地主机中有效运行,但在服务器中它只接受.xlsx格式

请检查

(调试)文件夹路径。

这是我们将代码上传到服务器时发生的一般错误。

有时,我们的代码与文档根目录位于不同的目录中。

这可能会产生问题。

是的,它现在被认为是在最新版本的 PHP 中弃用的。这是一个替代黑客:

function _mime_content_type($filename) {
$result = new finfo();
if (is_resource($result) === true)
{
    return $result->file($filename, FILEINFO_MIME_TYPE);
return false;
}