in reply to CGI - Creating Multipart Form with a File Download
AFAIAA your requirement cannot be satisfied without resorting to something like AJAX. A single CGI script can either display a page or return content as a download but not both. This is because the content type is specified by the Content-Type header and this can only be given once per request. In your code above you give this twice (see the two calls of the header() method) and so the second one has little effect which is why your file contents appear in the web page.
Either resort to AJAX or consider a different way of delivering the content to the user.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI - Creating Multipart Form with a File Download
by Anonymous Monk on Mar 13, 2015 at 22:50 UTC | |
|
Re^2: CGI - Creating Multipart Form with a File Download
by stefl (Acolyte) on Mar 14, 2015 at 13:50 UTC | |
by Your Mother (Archbishop) on Mar 14, 2015 at 19:55 UTC | |
by Anonymous Monk on Mar 15, 2015 at 02:13 UTC | |
by Anonymous Monk on Mar 14, 2015 at 16:59 UTC |