php - 当网站托管在centos vmware中时,无法获取$_FILE ["name"] ["tmp_name"]

标签 php linux joomla permissions centos

我使用 centos os 构建了一个 Web 服务器,并上传了 joomla 源代码。 网站运行良好!但是当我上传文件时,有些文件我可以获取$_FILE["name"]["tmp_name"],有些文件我无法获取$_FILE["name"]["tmp_name"] 我不知道原因。 经验:

$attachment = $_FILES['upload'];
echo "<pre>";
print_r($attachment);

输出: 在 centos 操作系统上:

    Array
(
    [name] => Array
        (
            [0] => myfile.zip
            [1] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
        )

    [type] => Array
        (
            [0] => //cannot get
            [1] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
        )

    [tmp_name] => Array
        (
            [0] => //cannot get
            [1] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
        )
}

在窗口上:

    Array
(
    [name] => Array
        (
            [0] => myfile.zip
            [1] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
        )

    [type] => Array
        (
            [0] => application/octet-stream
            [1] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
        )

    [tmp_name] => Array
        (
            [0] => C:\wamp\tmp\phpC2D7.tmp
            [1] => 
            [2] => 
            [3] => 
            [4] => 
            [5] => 
        )
}

感谢您的观看!

最佳答案

检查 php.ini 以确保您有该文件的临时路径。

upload_tmp_dir = [something or commented out to accept a server default]

关于php - 当网站托管在centos vmware中时,无法获取$_FILE ["name"] ["tmp_name"],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22264672/

相关文章:

php - Laravel 5 中不存在类 App\Http\Controllers\StudentController

python - 在 UNIX shell 中捕获 Python 进程的退出状态

linux - 从 bash 中的文件列表中删除前缀

joomla - 我们如何在 joomla 的组件 View 中获取模块参数

php - 这个 PHP 有什么作用?它是编码器/解码器吗?

php - 使用 php regexp 重新排序字符串的行

javascript - getElementById 无法获取 html id 的值

linux - R 2.15 在 Redhat 中安装

Joomla 2.5 : Error 500 : Internal Server Error

php - 在 joomla virutemart 中有 mysql 连接超时问题?