php最简单的文件上传代码
<?php
include("top.txt");
include("scripts.txt");
if(isset($_FILES['ufile']['name'])){
echo "Uploading: ".$_FILES['ufile']['name']."<br>";
$tmpName = $_FILES['ufile']['tmp_name'];
$newName = UPLOADEDFILES . $_FILES['ufile']['name'];
if(!is_uploaded_file($tmpName) || !move_uploaded_file($tmpName, $newName)){
echo "FAILED TO UPLOAD " . $_FILES['ufile']['name'] .
"<br>Temporary Name: $tmpName <br>";
} else {
echo "File uploaded. Thank you!";
}
} else {
echo "You need to select a file. Please try again.";
}
include("bottom.txt");
?>
时间: 2024-09-20 00:22:23