Skrevet av Emne: How to write a CGI script that generates a semicolon separated file  (Lest 5197 ganger)

ATC

  • Gjest
  • [applaud]0
  • [smite]0
  • When generating web content on-the-fly, the standard HTTP header used is "Content-type: text/html". However, this means the user has to actively click "File" and "Save as..." to get a file save dialogue. Furthermore, the default filename is the same as the CGI script filename.



    ATC

    • Gjest
    [Solved] How to write a CGI script that generates a semicolon separated file
    « Svar #1 på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • Use the following HTTP header instead:

    Content-type: application/octet-stream
    Content-Disposition: attachment; filename="filename.ext"


    This will cause most browsers to pop up the file "Save as..." dialogue automatically. Note that you may NOT specify a path.