9

I am trying to make an online kickstart config file creator. After the file is created on the server how do I get the download dialog to pop up so the user can download it?

Kaspar Lee
  • 5,266
  • 4
  • 30
  • 54
cskwrd
  • 2,663
  • 7
  • 35
  • 49

2 Answers2

18

Content-Disposition header..

// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');

http://au2.php.net/manual/en/function.header.php

russau
  • 8,499
  • 6
  • 38
  • 48
5

the magic is in the content-disposition

send a file to client

Community
  • 1
  • 1
Al W
  • 7,388
  • 1
  • 18
  • 39