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,446
  • 4
  • 31
  • 54
cskwrd
  • 2,803
  • 8
  • 38
  • 51

2 Answers2

19

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,928
  • 6
  • 39
  • 49
5

the magic is in the content-disposition

send a file to client

Community
  • 1
  • 1
Al W
  • 7,539
  • 1
  • 19
  • 40