php - Start download automatically when a user navigates to another page -


i wondering how accomplish effect i've seen on several websites, click download link, takes me page, , download starts automatically. best way accomplish this?

redirect page emits following headers:

header("content-disposition: attachment; filename=$filename"); header("content-length: $length"); 

see this post restrictions on $filename.

edit in response andr's answer, php equivalent of redirect-after-x-seconds be:

header("refresh: 2; url=start_download.php"); 

(although should officially specify complete url, think) start_download.php contain 2 lines above.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -