【问题标题】:Cannot get $_FILE["name"]["tmp_name"] when website host in centos vmwarecentos vmware中网站主机时无法获取$_FILE["name"]["tmp_name"]
【发布时间】:2014-03-08 03:34:34
【问题描述】:

我使用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 linux joomla permissions centos


    【解决方案1】:

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

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

    【讨论】:

    • 是的,我做到了。在 etc/php.ini.upload_tmp_dir="/tmp"
    • 您是否尝试过删除它并让 apache 将临时路径设置为默认值?
    • 好的,我尝试删除它并设置 temp 默认值。但有些文件我可以得到 $_FILES["name"]["tmp_name"] 并不是全部。
    • 可能应该先问这个,但是 $_FILE["error"] 里面有什么吗?
    猜你喜欢
    • 2014-06-18
    • 1970-01-01
    • 1970-01-01
    • 2021-08-13
    • 2016-01-25
    • 1970-01-01
    • 2015-07-01
    • 1970-01-01
    • 2017-09-19
    相关资源
    最近更新 更多