【问题标题】:Problem with move_uploaded_file(); ($_POST)move_uploaded_file() 有问题; ($_POST)
【发布时间】:2021-11-20 20:52:14
【问题描述】:
if(isset($_POST['Descrizione']) && isset($_POST['ID']) && isset($_POST['File'])) {
    $info = pathinfo($_POST['File'], PATHINFO_EXTENSION);
    if($info == "gif") {
        move_uploaded_file($_FILES['File']['name'], "/ms-swf/c_images/album1584");
    }
}

我想移动使用 $_POST 方法上传的文件。我怎样才能做到这一点?如果我能。如果没有,我该如何解决它以使其正常工作?谢谢

【问题讨论】:

  • 开启你需要的error_reporting $_FILES['file']['tmp_name']
  • $_POST['File']$_FILES['File'] 不同

标签: php file post


【解决方案1】:

move_uploaded_file函数需要使用已上传文件的tmp_name

move_uploaded_file($_FILES['File']['tmp_name'], "/ms-swf/c_images/album1584");

【讨论】:

  • 那仍然没有移动文件。
  • 好的,您可以使用var_dump($_FILES); var_dump($_POST); 并使用结果编辑您的问题。如果move_uploaded_file 失败,它将返回false,但如果它无法写入目标,也会发出警告。
  • 你能解释清楚点吗?
  • 您的问题是文件没有被移动。我们需要找出为什么它没有被移动。可能永远不会调用 move_uploaded_file,因为 if 语句的评估结果不正确。
猜你喜欢
  • 1970-01-01
  • 2014-07-05
  • 2016-09-19
  • 1970-01-01
  • 2011-07-20
  • 1970-01-01
  • 1970-01-01
  • 2011-07-15
  • 2011-07-10
相关资源
最近更新 更多