douhao9203 2016-02-09 10:40
浏览 51

php上传错误= 0,文件不存在

After updating to php 5.6.17 (Centos 6.5) files are not uploading.

$_FILES variable dump below

Array(
[files] => Array
    (
        [name] => file.pdf
        [type] => application/pdf
        [tmp_name] => /etc/folder/temp/phprm2HZS
        [error] => 0
        [size] => 1500433
    )

)

if I try file_exists($_FILES['files']['tmp_name']) returns false

if I list the contents of that temp folder it's empty, and surely move_uploaded_file returns false, and no exception is caught.

Edit:

Problem was that /tmp is not in apache's open_basedir

Fixed now

  • 写回答

1条回答 默认 最新

  • douqiangchuai7674 2016-02-09 10:49
    关注

    You try something like

    $path = '/uploads'; // path of your image upload folder 
    
    if( chmod($path, 0777) ) {
         move_uploaded_file ( string $filename , string $destination ){
            //rest code
         }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集
  • ¥15 在启动roslaunch时出现如下问题