我正在尝试将 XML 文件上传到服务器,该文件名为data.xml
. 每次访问数据时,数据总是会被覆盖。
我的疑问是如何将文件名设置为带有.xml
扩展名的固定名称作为扩展名过滤器?我想将文件放在与upload.php
.
这是我到目前为止所尝试的:
<?php
$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!";
}