函数is_uploaded_file()不起作用..总是返回一个错误的标志 [英] function is_uploaded_file( ) not working .. always returns a false flag

查看:131
本文介绍了函数is_uploaded_file()不起作用..总是返回一个错误的标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过PHP scipt上传文件.

I am uploading a file through PHP scipt ..

我的代码是

$file_temp=$_FILES["upl"]["tmp_name"];

当我上传东西时

move_upload_file($file_temp,"user_stuff/".$file_name)

一切正常..上传内容而没有灾难

Everything works fine .. stuff get uploaded with no disaster

但是当我使用

is_uploaded_file($file_temp);

它总是返回false

It always return false

所以我搜索了这个问题,并将其重定向到相同的stackoverflow问题

So i googled the problem and it redirected me to the same stackoverflow problem here

我照建议了做

 if(is_uploaded_file(realpath($file_temp)))
        {
            echo "done";
        }
        else
        {
            echo "fail";
        }

但是仍然遇到相同的失败"问题

But still getting the same problem "fail"

此外,我只是注意到了一件奇怪的事情……当我不使用move_uploaded_file(..)时,is_uploaded_file可以正常工作

Moreover, i just noticed a strange thing ... when i am not using move_uploaded_file(..) , the is_uploaded_file "works"

推荐答案

在控制台中尝试sudo chmod 777 path_to_directory/user_stuff/-R

try sudo chmod 777 path_to_directory/user_stuff/ -R in your console

这篇关于函数is_uploaded_file()不起作用..总是返回一个错误的标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆