Reputation: 1229
I m trying to save PDF in shared folder. But its giving me error. I manually checked that path is right or not. but its right. But still I m not able to generate PDF.
Here is my code
<?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');
?>
Error
TCPDF ERROR: Unable to create output file: \\ADMIN\testsor\pdf\test.pdf
Upvotes: 0
Views: 1677
Reputation: 957
make sure that file \ADMIN\testsor\pdf\test.pdf is not open anywhere when you run script. if it's open somewhere else then TCPDF can't open it.
Upvotes: 1
Reputation: 4065
You have give permission in your server.
ADMIN/testsor( Folder ) -> Right click -> Properties -> Security -> Edit -> {Select User} -> Allow Full Control Check-> OK
and try again
Upvotes: 0
Reputation: 1229
I Solved this issue. May be its also helps to other. Here problem was its not saving the pdf in shared folder. I shared this folder for all users and also give full access.But still its not worked. So I realized its something related to security I checked In folder->RightClick->Property->Advance share folder->Security.I found that here 'everyone' option(i.e added in share->group/username ) is not added. So I added and then its working.
Upvotes: 0
Reputation: 757
if this is shared folder, contact the admin/owner of computer/server where the folder belong to, to give you access to read and write on the shared folder
Upvotes: 0
Reputation: 418
do you have the necessary permissions to write to ? you can change it like this chmod -R 0777 /pdf
Upvotes: 0