PHP - Superglobals and Web Context
You want to save an uploaded file only if it is less than 2MB and has no errors. Which code snippet correctly checks these conditions before moving the file?
if (/* condition here */) {
move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/' . $_FILES['file']['name']);
echo 'Upload successful';
} else {
echo 'Upload failed';
}