-2
<?php

$target_path = "./" . 'data.xml';

if (move_uploaded_file('data.xml', $target_path)) {
    echo "The file  has been uploaded";
} else {
    echo "There was an error uploading the file, please try again!";

}
?>

上面的 PHP 脚本似乎不起作用。我尝试向此链接发送 HTTP POST 请求。我最终得到一个布尔否,是的move_uploaded_file,说有一个错误。

我想知道这里出了什么问题。

4

1 回答 1

1
$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
" has been uploaded";
} 
else
{
echo "There was an error uploading the file, please try again!";
}
于 2013-02-20T03:58:18.960 回答