我試圖將PDF保存在共享文件夾中。但它給了我錯誤。我手動檢查路徑是否正確。但它的權利。但我仍然無法生成PDF。如何使用TCPDF將PDF保存在共享文件夾中
這裏是我的代碼
<?php
$file = "//ADMIN/testsor/SORPDF.csv";
$handle = fopen($file,"r");
$data= fgetcsv($handle);
//print_r($data);exit;
$filename="Test.pdf";
$filepath="\\\\ADMIN\\testsor\\pdf";
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->setFooterData(array(0,64,0), array(0,64,128));
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
$pdf->AddPage();
$pdf->SetFont('times', '',11);
$pdf->setPage(1, true);
$txt = '
<table cellpadding="1" border="1" cellspacing="0" width="100%" class="main">
<tr><td class="cen"> </td><td style="padding-right:7px" align="right"><strong>Signature</strong> </td><td colspan="3" align="center" height="50px"><img src="'.$data[0].'" height="20px" width="100px" >
</td></tr>
<tr><td class="cen"> </td><td style="padding-right:7px" align="right"><strong>Fitter`s Signature</strong> </td><td colspan="3" align="center" height="50px"><img src="'.$data[1].'" height="20px" width="100px" >
</td></tr>
</table>
';
$pdf->writeHTML($txt,1,null,null,null,null);
$fileNL = $filepath."\\".$filename;
$pdf->Output($fileNL,'F');
?>
錯誤
TCPDF ERROR: Unable to create output file: \\ADMIN\testsor\pdf\test.pdf
我如何在這裏使用它? – kreya 2014-11-25 12:41:32
可否請您寫完整路徑 – kreya 2014-11-25 12:41:58
您不要在此處使用它,基本上您需要轉到該文件夾並更改寫入權限。該錯誤表示它是隻讀的,所以最簡單的方法是使用ftp連接到服務器並右鍵單擊,然後在菜單「chmod」中看到某些內容。 – 2014-11-25 12:43:41