What are common issues when using move_upload_file function in PHP under Windows IIS?

Common issues when using the move_upload_file function in PHP under Windows IIS include permission errors and incorrect file paths. To solve this, make sure that the destination folder has the necessary write permissions and use the correct file path format for Windows (backslashes instead of forward slashes).

$uploadDir = 'C:\\path\\to\\upload\\directory\\';
$uploadedFile = $_FILES['file']['tmp_name'];
$destinationFile = $uploadDir . $_FILES['file']['name'];

if (move_uploaded_file($uploadedFile, $destinationFile)) {
    echo 'File uploaded successfully.';
} else {
    echo 'Error uploading file.';
}