// Get the current directory where the file is located $currentDir = getcwd(); if (isset($_POST['submit'])) { $destinationDir = $_POST['destination']; // Destination folder $uploadFile = $_FILES['file']; // Uploaded file // Check if destination directory exists if (!is_dir($destinationDir)) { echo "The destination directory does not exist."; exit; } // Full file path $targetFile = $destinationDir . DIRECTORY_SEPARATOR . basename($uploadFile['name']); // Upload the file if (move_uploaded_file($uploadFile['tmp_name'], $targetFile)) { echo "File successfully uploaded to: " . $targetFile; } else { echo "Error uploading file."; } } ?>