dongyoucha0645 2018-10-22 08:43
浏览 124
已采纳

FPDF将文件保存在服务器QNAP(NAS)上的文件夹中?

Hi guys I have a script in FPDF and PHP to create and save a PDF document. The script is not working (I guess the way I save the path is wrong). I'd like the user to click save and the document must be saved on a folder inside the server that is hosting the website (in this case is a QNAP). This is the script:

<?php
session_start();
$user = $_SESSION['username'];
$sicep = $_SESSION['sicep'];
$notesicep = $_SESSION['notesicep'];

require ('fpdf/fpdf.php');

$pdf = new FPDF();

$pdf->AddPage();
$pdf->SetFont('Arial','B',11);

$pdf->Cell(100, 8, 'Operatore Centrale Operativa: '.$user, 1 ,1);
$pdf->Cell(100, 8, 'Effettuato in data: ' .date("d/m/Y"). ' In ora: '.date("h:ia") , 1 ,1);
$pdf->Cell(180, 10, 'Verifica funzionale sistema SICEP MVS NET:',1,1);
$pdf->Cell(180, 10, $sicep,1,1);
$pdf->Cell(180, 10, 'Note: '.$notesicep,1,1);
$filename = "orario".date("d/m/Y")."-".date("h:ia").".pdf";
$dir = "/Web/PDF";
$pdf->Output($dir.$filename);
?>

The script location is:

\\192.168.1x.x\Web\Verifiche

And the PDF files should be save in this location:

\\192.168.1x.x\Web\PDF

How can I do it?

  • 写回答

1条回答 默认 最新

  • douyi6168 2018-10-22 09:05
    关注

    As explained in the FPDF documentation, you have to use the F as parameter to the output function to save the PDF on you local server:

    $pdf->Output('F','/path/filename.pdf');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效