Home >Backend Development >PHP Tutorial >PHP file upload main code explanation_PHP tutorial

PHP file upload main code explanation_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:13:27911browse

Copy code The code is as follows:

if($_FILES['myfile'][' name'] != '') {
if($_FILES['myfile']['error'] > 0) {
echo "Error status:" . $_FILES['myfile'][' error'];
} else {
move_uploaded_file($_FILES['myfile']['tmp_name'], "uploads/" . $FILES['myfile']['name']);
echo "<script>alert(Upload successful!);</script>";
}
} else{
echo "