0

我正在使用 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 格式

4

2 回答 2

0

请检查(调试)文件夹路径。

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

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

这可能会产生问题。

于 2013-09-26T05:31:11.963 回答
-1

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

function _mime_content_type($filename) {

$result = new finfo();

if (is_resource($result) === true)
{
    return $result->file($filename, FILEINFO_MIME_TYPE);

return false;
}
于 2013-09-26T05:39:01.043 回答