Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fopen(); "Remote host file access not accepted" on a local file?

Tags:

I am using the Tcpdf module and PHP to create dymanic PDF invoices from an ordering system.

The script should then save the invoice into a folder called "invoices". The folder exists, and there are full permissions for "everyone" (Windows).

The code I am using is this:

$pdf->Output('invoices/Delivery Note.pdf', 'F'); 

This uses fopen to save the file.

However the error I am getting is: Warning: fopen(): remote host file access not supported, file://invoices/Delivery Note.pdf

This is a local file, not a remote one.

I attempted adding a / prefix like this:

$pdf->Output('/invoices/Delivery Note.pdf', 'F'); 

but then I get this error instead: Warning: fopen(file:///invoices/Delivery Note.pdf): failed to open stream: No such file or directory

I created the file, and left it empty, but the same error as above.

Does anyone know why I am getting this error?

like image 298
user2924019 Avatar asked Mar 04 '15 11:03

user2924019


1 Answers

From php-Script you can use:

$pdf->Output(__DIR__ . '/invoices/Delivery Note.pdf', 'F'); 
like image 140
Gerd Avatar answered Oct 08 '22 08:10

Gerd