2014-11-10 3 views
0

저는 phpmysqldompdf으로 웹 사이트를 개발하고 있습니다. 내 양식 중 하나에 버튼이 있습니다. pdf 파일 이상을 이메일로 보내주십시오. (내 로컬 호스트에서 pdf 파일을 생성 할 수 있지만 전자 메일은 보내지 마십시오. 웹 서버에서 pdf를 만들 수는 없지만 전자 메일이 보내집니다 ...)스트림을 열지 못했습니다 : 사용 권한이 거부되었습니다

메시지 I 볼 수 있습니다 : 나는 이메일을받을

$codigoHTML=utf8_decode($codigoHTML); 
$dompdf=new DOMPDF(); 
$dompdf->load_html($codigoHTML); 
ini_set("memory_limit","128M"); 
$dompdf->render(); 
$pdf = $dompdf->output(); 

file_put_contents("pdf/pdfgenerados/cotizacionnueva.pdf", $pdf); 



echo "Cotización generada"; 


//<<-------------- Send by email------------>>> 

$fileat = "pdf/pdfgenerados/cotizacionnueva.pdf"; 
$fileat_type="pdf"; 
$fileatname= "Cotización.pdf"; 

$emailfrom="[email protected]"; 
$emailsubject="Cotización"; 
$emailmessage="------------ Here you have the pdf file... have a nice day"; 
$emailto="[email protected]";// 
$headers = "From: $emailfrom"; 

$file = fopen($fileat,'rb'); 
$data = fread($file,filesize($fileat)); 
fclose($file); 

$semi_rand = md5(time()); 
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 


$data = chunk_split(base64_encode($data)); 
$data . "nn --{$mime_boundary}--n"; 

$ok = @mail($emailto, $emailsubject, $emailmessage, $headers); 

    if($ok) { 
    echo " <br/><font face=verdana size=2>The file was successfully sent!</font>"; 
    } else { 
    die("Sorry but the email could not be sent. Please go back and try again!"); 
    } 

:

Warning: file_put_contents(C:/Inetpub/vhosts/.../dompdf/lib/fonts/log.htm) [function.file-put-contents]: failed to open stream: Permission denied in C:\Inetpub\vhosts\...\dompdf\include\dompdf.cls.php on line 864 
//the mistake in in the `dompdf` class 

Warning: file_put_contents(pdf/pdfgenerados/cotizacion.pdf) [function.file-put-contents]: failed to open stream: Permission denied in C:\Inetpub\vhosts\...\list.php on line 116 

이 내 코드입니다. 그러나 나는 pdf를 받는다. 파일

무엇을 할 수 있습니까 ???

답변

0

당신은 아마 폴더에 액세스 권한이없는

pdf/pdfgenerados/ 

가지 적어이 폴더에 대한 읽기/쓰기 액세스, 그리고 이미 mPDF 노력 때문에이 문제가 발생

1

있는 경우 또한, cotizacionnueva.pdf를 제출 TTFONTDATA 폴더에 임시 파일을 작성하는

당신은에 _MPDF_TTFONTDATAPATH 경로를 변경하여 TTFONTDATA 폴더에 쓰기 권한을 0777 또는 를 제공하여 해결할 수 있습니다 Linux 임시 디렉토리 mPDF 인스턴스를 만들기 전에 다음 줄을 추가하여

define ('_ MPDF_TTFONTDATAPATH', sys_get_temp_dir(). "/");

관련 문제