I am trying to save a pdf document generated with the library to a path on my network TCPDF
, but I have not succeeded despite the fact that the folder has full permissions for Everyone and Anonymous Logon . ( in a local folder on the server if the pdf is stored correctly )
I have tried this way:
$this->folder = '//servidor/carpeta/nombreArchivo.php';
$this->pdf = Output($this->folder, 'F');
And I get this error:
Warning: fopen(file:////server/folder/filename.php): failed to open stream: No such file or directory in ...\TCPDF\include\tcpdf_static.php on line 1821
TCPDF ERROR: Unable to create output file: //server/folder/filename.php
And in this way:
$this->folder = '\\\\servidor\\carpeta\\nombreArchivo.php';
$this->pdf = Output($this->folder, 'F');
Getting the following error:
Warning: fopen(): remote host file access not supported, file://\server\folder\filename.php in ...\TCPDF\include\tcpdf_static.php on line 1821
Warning: fopen(file://\server\folder\filename.php): failed to open stream: no suitable wrapper could be found in ...\TCPDF\include\tcpdf_static.php on line 1821
TCPDF ERROR: Unable to create output file: \server\folder\filename.php
Any idea what might be going on that won't let me store the file on this network path?
PS: I already tried storing the pdf in a local folder and using the function copy
to PHP
copy the file to the network path, obtaining a similar result:
Warning: copy(//server/folder/filename.php): failed to open stream: Permissions denied in ...\project\Controllers\generatePdf.php on line 37
After some research, I opted to solve it with a connection
FTP
.In this way I generate the file on the local server with
TCPDF
and later transfer it to the remote server through the functionsFTP
ofPHP
.Here you find the different functions available, although with the basic ones it should be enough.
In the official documentation they expose an example of basic use.
I hope this information will serve as a reference to someone who has a similar case.