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');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了