PHP generate file for download then redirect -
I have a PHP app that creates a CSV file that is forced to download to use the header code here The relevant part of:
header ('content-type: application / csv'); Header ("Content-Length:". Filiaia ($ Newfile)); Header ('content-dispute: attachment; filename =' '. $ Filename.' '' ''); Counterpart $ content; Go out(); What I would like to do, after the file is created, users are redirected to a new page and the download prompt is sent. Simply adding header ("location: / new page") did not work in the end, hopefully, so I'm not sure how to do this.
I do not think this can be done - though I'm not 100% sure.
The normal thing (popular download sites, for example) is reverse: first you go to the "After" page and then the download starts.
Then redirect your users to the "last" page (among other things):
Your download should start automatically if [a href = "create_csv.php"] Not clicked [/ a]
About the start of the download (such as automatically making the create_csv.php call) you have several options:
- HTML: [Meta http-equiv = "Refresh" content = "5; url ="]
- Javascript: location.href = '';
- Iframe: [Iframe src = "create_csv.php"] [/ iframe]
Comments
Post a Comment