问题描述
我正在使用FPDF库来提供PDF文件.我的项目的一部分包括使用此库来为消费者生成PDF文件. 我们正在使用" OVH"下的服务器测试.我在" OVH"中的空间的树木是:/www/betatest.
一个名为上传的文件夹,其中包含toxtures的文件夹,其中所有tasture的pdf文件都将在其中. 因此,当我尝试在" tastures"文件夹中生成PDF文件时,在网络浏览器中会显示我:
警告:fopen(upload/fortures/tast_98.pdf)[function.fopen]:未能打开流:/homez.742/coplayer/www/www/betatest/library/library/library/fppdf/fpdf.php在第1025行
上fpdf错误:无法创建输出文件:upload/fortures/tast_98.pdf.
我尝试了很多我在此网站中发现但行不通的东西. 请帮我.非常感谢! :)
推荐答案
确保目录至少具有755.另外,使用$_SERVER['DOCUMENT_ROOT']在目标方面使用良好目录:
$nomFacture = $_SERVER['DOCUMENT_ROOT']."upload/factures/facture_".$idFacture.".pdf";
会产生
之类的东西/homez.742/coplayer/www/betatest/upload/factures/facture_12.pdf
其他推荐答案
在使用Output("path_file", "F")生成PDF之前,请确保您没有发送到其他内容(例如echo,var_dump,等). 这是强制性的.
其他推荐答案
确保文件上传/fortures/tast_98.pdf 在运行脚本时不会在任何地方打开.如果它在其他地方打开,则TCPDF无法打开.
问题描述
I'm working with fpdf libray for providing pdf files. A part of my project consists of using this library to generate pdf files for consumers. We are working with a server test under "ovh". The arborescence of my space in "ovh" is : /www/betatest.
A folder named upload which contains factures's folder where all the facture's pdf files will be there. So, when i try to generate a pdf file inside the factures folder, in a web browser it displays me :
Warning: fopen(upload/factures/facture_98.pdf) [function.fopen]: failed to open stream: Success in /homez.742/coplayer/www/betatest/library/fpdf/fpdf.php on line 1025
FPDF error: Unable to create output file: upload/factures/facture_98.pdf.
I tried a lot of things that i found in this web site but does not work. Please help me. Thank's a lot! :)
推荐答案
Make sure the directory have at least a 755. Also, use $_SERVER['DOCUMENT_ROOT'] with your path to target the good directory :
$nomFacture = $_SERVER['DOCUMENT_ROOT']."upload/factures/facture_".$idFacture.".pdf";
That will produce something like
/homez.742/coplayer/www/betatest/upload/factures/facture_12.pdf
其他推荐答案
Make sure you have not sending to output something else (like echo, var_dump, etc.) before generating PDF with Output("path_file", "F"). It is mandatory.
其他推荐答案
make sure that file upload/factures/facture_98.pdf is not open anywhere when you run script. if it's open somewhere else then TCPDF can't open it.