require(..\_lib\vendor\phpmailer\phpmailer): failed to open stream: No such


New member
Hi Team

I have a phpmailer file that send email with attached document, but i now get this weird error. How do i get rid of this error from this path when using phpmailer?

PHP Warning: require(..\_lib\vendor\phpmailer\phpmailer): failed to open stream: No such file or directory in /home/acifinan/public_html/send-email-attachment.php on line 3

// code to send attachment for pdf
require '..\_lib\vendor\phpmailer\phpmailer';
use PHPMailer\PHPMailer;

$msg = '';
if (array_key_exists('bankstatement', $_FILES)) {
    //Create a message
    $mail = new PHPMailer();
    $mail->setFrom('info@acifinance', 'ACI Finance');
    $mail->addAddress('', 'ACI Finance');
    $mail->Subject = 'ACI Finance Application Loan';
    $mail->Body = 'My message body';
    //Attach multiple files one by one
    for ($ct = 0, $ctMax = count($_FILES['bankstatement']['tmp_name']); $ct < $ctMax; $ct++) {
        //Extract an extension from the provided filename
        $ext = PHPMailer::mb_pathinfo($_FILES['bankstatement']['name'][$ct], PATHINFO_EXTENSION);
        //Define a safe location to move the uploaded file to, preserving the extension
        $uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['bankstatement']['name'][$ct])) . '.' . $ext;
        $filename = $_FILES['bankstatement']['name'][$ct];
        if (move_uploaded_file($_FILES['bankstatement']['tmp_name'][$ct], $uploadfile)) {
            if (!$mail->addAttachment($uploadfile, $filename)) {
                $msg .= 'Failed to attach file ' . $filename;
        } else {
            $msg .= 'Failed to move file to ' . $uploadfile;
    if (!$mail->send()) {
        $msg .= 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        $msg .= 'Message sent!';

// html code to attached documents as pdf
                                SELECT A pdf FILE TO UPLOAD
                                 <label>ID </label><br>
                                <input type="File" name="id" id="id" accept=".pdf">
                                <label>Bank Statement </label><br>
                                <input type="File" name="bankstatement" id="bankstatement" accept=".pdf">
                                <label>Pay Slip </label><br>
                                <input type="File" name="payslip" id="payslip" accept=".pdf">
                                <input type="Submit" id="btnNow" class="btn apply-btn mt-30" name="button" value="APPLY NOW">
Use slashes instead of backslashes and verify that the path is correct. Try to use realpath function