Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 472.4k

file_get_contents(FASHION SHOW.pdf): failed to open stream:

Mar 3 2023 2:10 PM

Hi Team

I need some help, i am sending pdf email but the problem when inspect stack trace using logs. Im getting this problem and dont know how to fix it  file_get_contents(FASHION SHOW.pdf): failed to open stream: No such file or directory in /home/acifinan/public_html/application.php on line 94

 

// application.php

--- Function to send email as attached is below

function send_pdf_to_user(){
   
    if($_REQUEST['action'] == 'pdf_invoice' ){
        
        require('application.php');
        
        require_once('class.phpmailer.php');
    
        $pdf=new PDF_HTML();
        
        $pdf->SetFont('Arial','',11);
        
        $pdf->AddPage();
        

        $text = get_html_message($_REQUEST['Amount'], $_REQUEST['Purpose'], $_REQUEST['Voucher']);
        if(ini_get('magic_quotes_gpc')=='1')
        $text=stripslashes($text);
        $pdf->WriteHTML($text);

        $mail = new PHPMailer(); // defaults to using php "mail()"
        $body = "";
       
        $mail->AddReplyTo("[email protected]","Test Lernt");
        $mail->SetFrom('[email protected]', 'Test Lernt');
       
        $address = "[email protected]";
		
		$mail->AddAddress($address, "ACI Finance");       
        $mail->Subject    = "Application for a Loan";       
        $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
       
        $mail->MsgHTML($body);
             
        $pdf->Output("Application Loan.pdf","F");
        $path = "application.pdf";
         
        $mail->AddAttachment($path, '', $encoding = 'base64', $type = 'application/pdf');
        global $message;
        if(!$mail->Send()) {
          $message =  "Application for a loan could not be send. Mailer Error: " . $mail->ErrorInfo;
        } else {
          $message = "Application for a loan is sent!";
        }
        
       
    }
}


// application.php query to the db and file format of the document with Content header

echo "after function";
   $to = "[email protected]";
   $from = $_REQUEST['email'];
 $content = file_get_contents($filenameee);// main concerned is here
   $content = chunk_split(base64_encode($content));
    // main header (multipart mandatory)
 $headers = "From: ".$from." <".$from.">" . $eol;
 $headers .= "MIME-Version: 1.0" . $eol;
 $headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol;
 $headers .= "Content-Transfer-Encoding: 7bit" . $eol;
 $headers .= "This is a MIME encoded message." . $eol;
	$headers .= "MIME-Version: 1.0\r\n";
	$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
 
    $subject = "Application Form";
   
 // a random hash will be necessary to send mixed content
 $separator = md5(time());
 
 // carriage return type (RFC)
 $eol = "\r\n";

 


Answers (1)