dsjojts9734
2017-10-25 14:38
浏览 288
已采纳

php move_uploaded_file返回true但localhost上缺少文件

I am trying to move one image to new folder move_uploaded_file is returning 1 but the file is missing, I am working on localhost with XAMPP

$name = basename($_FILES['arr']['name'][0]);
move_uploaded_file($_FILES['arr']['tmp_name'][0],"\Images");

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

我正在尝试将一个图像移动到新文件夹 move_uploaded_file 返回1但是文件 缺少,我正在使用XAMPP

  $ name = basename($ _ FILES ['arr'] ['name'] [0]); 
move_uploaded_file($  _FILES ['arr'] ['tmp_name'] [0],“\ Images”); 
   
 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dsfsdfsdfsdf6455 2017-10-25 14:43
    已采纳

    You should specify the destination file name

    if ( move_uploaded_file($_FILES['arr']['tmp_name'],dirname(__FILE__) . '/images/' . $_FILES['arr']['name'] ) ) {
        echo "file uploaded";
    } else {
       echo "error in uploading";
    }
    
    已采纳该答案
    打赏 评论
  • dqpd4268 2017-10-25 14:43
    $name = basename($_FILES['arr']['name'][0]);
    move_uploaded_file($_FILES['arr']['tmp_name'][0],'/images/' . $filename);
    

    You have to add a destination for the file to go, including the filename that you wish to assign to it.

    Refer to: http://php.net/manual/en/function.move-uploaded-file.php

    打赏 评论

相关推荐 更多相似问题