2014-11-25 131 views
0

我試圖將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">&nbsp;</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">&nbsp;</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 

回答

0

你有必要的權限來寫? 你可以改變它這樣 搭配chmod -R 0777/PDF

+0

我如何在這裏使用它? – kreya 2014-11-25 12:41:32

+0

可否請您寫完整路徑 – kreya 2014-11-25 12:41:58

+0

您不要在此處使用它,基本上您需要轉到該文件夾​​並更改寫入權限。該錯誤表示它是隻讀的,所以最簡單的方法是使用ftp連接到服務器並右鍵單擊,然後在菜單「chmod」中看到某些內容。 – 2014-11-25 12:43:41

0

如果這是共享的文件夾,請與計算機/服務器的管理員/所有者其中文件夾屬於,給你訪問讀取和共享寫入文件夾

0

我解決了這個問題。可能對其他人也有幫助。 這裏的問題是它沒有保存在共享文件夾中的pdf。 我爲所有用戶共享此文件夾,並給予完全訪問權限,但仍然沒有工作。 所以我意識到它與安全相關的東西我檢查了在文件夾 - >右鍵 - >屬性 - >高級共享文件夾 - > Security.I發現這裏'每個人'選項(即添加在共享 - >組/用戶名)不會添加。所以我補充說,然後工作。

0

您已在服務器中授予權限。

ADMIN/testsor(文件夾) - >右鍵 - >屬性 - >安全 - >編輯 - > {選擇用戶} - >允許完全控制檢查 - >確定

,然後再試一次

相關問題