// Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; }