2010-05-25 21:34
浏览 49


move_uploaded_file() won't work for me anymore, it was working fine and just stopped out of nowhere. Is there a way for me to check why it's not working anymore? Here's what I currently have, but it only returns TRUE or FALSE.

$status = move_uploaded_file($tempFile, $targetFile);
if($status) {
  echo 'its good';
} else {
  echo 'it failed';

I know the path is 100% correct and the directory is CHMOD 755. Is there anything I might be doing wrong?

图片转代码服务由CSDN问答提供 功能建议

move_uploaded_file()将不再适用于我,它工作正常,并且无处不在。 有没有办法让我检查它为什么不再工作? 这是我现在拥有的,但它只返回TRUE或FALSE。

  $ status = move_uploaded_file($ tempFile,$ targetFile); 
if($ status){
 echo  “它很好”; 
 echo'ave failed'; 

我知道路径100%正确且目录是 CHMOD 755.有什么我可能做错了吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongzhi2014 2010-05-25 21:47

    Maybe this will work:

    if(!move_uploaded_file($_FILES['attachement']['tmp_name'], $uploadfile)) {
    echo 'Your file was not uploaded please try again
    here are your debug informations:
          } else {
              echo 'image succesfully uploaded!';
    打赏 评论
  • duancilan5124 2010-05-25 21:56

    Check your error reporting level (see error_reporting function). You should get a warning or notice that's a bit more descriptive.

    Also, check that the user your PHP script runs as (usually the server's user, which is nobody or www-data on a lot of systems, but YMMV) owns the directory. With 755, only the owner of the directory can write to it.

    打赏 评论
  • dongwo8827523 2010-05-25 21:56

    Permissions of 755 means that only the owner of the directory can write to that directory.

    So the question is, who is the owner and as what user is the web-server / php running?

    If they don´t match, you can either change the ownership or the group (also changing the permissions to 775).

    打赏 评论

相关推荐 更多相似问题