我試圖將XML文件上傳到服務器,並且該文件被命名爲data.xml
。數據每次訪問時都會被覆蓋。upload.php腳本的固定文件名
我的疑問是如何將文件名設置爲固定名稱,並使用.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!";
}
你爲什麼要固定文件名? – 2013-02-19 20:18:47
該文件稍後將由另一個系統訪問。該文件將在用戶每次點擊時讀取。 – DesperateLearner 2013-02-19 20:22:30
你的問題是什麼? – hakre 2013-02-20 10:38:16