Are there specific permissions or configurations needed to successfully upload and attach files in a PHP form mailer on a Windows server?

When uploading and attaching files in a PHP form mailer on a Windows server, you may need to ensure that the folder where the files are being uploaded has the correct permissions set to allow file uploads. Additionally, you may need to configure the PHP settings to allow file uploads and set the maximum file size allowed for uploads.

<?php
// Set the upload directory path
$uploadDir = 'uploads/';

// Check if the directory exists, if not create it
if (!file_exists($uploadDir)) {
    mkdir($uploadDir, 0777, true);
}

// Set the maximum file size allowed for uploads
ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');

// Process file upload
if ($_FILES['file']['error'] == UPLOAD_ERR_OK) {
    $fileName = $_FILES['file']['name'];
    $tmpName = $_FILES['file']['tmp_name'];
    $fileSize = $_FILES['file']['size'];
    $fileType = $_FILES['file']['type'];

    // Move uploaded file to the upload directory
    move_uploaded_file($tmpName, $uploadDir . $fileName);
}
?>