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 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式