0

My code generates a PDF and saves to a server. the user can access a view the PDF however i wish to incorporate a save function. I have see that adding the document to the header will work, however generated code is in a separate php file and doesn't trigger a download.

header('Content-Disposition: attachment; filename="file.pdf"')

Bish25
  • 606
  • 1
  • 10
  • 35

1 Answers1

0

The header is used by your browser so that it knows how to handle what it receives. This particular handler tells the browser that its receiving a document that should be downloaded, however you need to send the content of the document with readfile or any other function doing the same thing.

vincenth
  • 1,732
  • 5
  • 19
  • 27