Search code examples
phplinuxwindowsftpfpdf

fpdf permissions on windows shared hosting


I'm facing a permission issue using fdpf on windows shared hosting. My client has a hosting account on windows server with a custom control panel with very limited options. When fpdf tries to create de pdf it gives a fopen error.

A workaround that I thought it would work would be saving the pdf file via ftp to my linux server. Is that possible? How can I accomplish this?

The code for creating the pdf file is

$pdf->Output('result.pdf', 'F');

How can I save it via pdf to a folder on my server instead of using a folder on client hosting?

Cheers


Solution

  • You can connect with ftp_connect() if your server supports that. More information on https://www.php.net/ftp_connect

    As soon as you have a connection you can try to save the file there. Not sure if that works. And FTP is not the most secure way. It is sending password as plain text.

    Another option would be to mail the pdf to yourself or your server.