我的基本PHP上传和重命名文件脚本不';行不通
上传后应该重命名文件,对吗 这是完整的脚本,应该是这样的我的基本PHP上传和重命名文件脚本不';行不通,php,Php,上传后应该重命名文件,对吗 这是完整的脚本,应该是这样的 重命名($\u FILES.txt,$\u FILES.html)改为查看此-重命名(“$\u FILES.txt”,“$\u FILES.html”)看起来不对。 // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok,
重命名($\u FILES.txt,$\u FILES.html)代码>改为查看此-重命名(“$\u FILES.txt”,“$\u FILES.html”)代码>看起来不对。
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
rename ("$_FILES.txt", "$_FILES.html");
} else {
echo "Sorry, there was an error uploading your file.";
}
}