Forum Moderators: coopster

Message Too Old, No Replies

A Force Download Script or.?

         

ChrisBolton

2:38 pm on Nov 4, 2009 (gmt 0)

10+ Year Member




I'm looking for a script that will redirect a user to a page with installation instructions after they have clicked a button to download a file.

I would like it to be similar to the process you see on most poker websites today. A user clicks a download button on the home page, the open/save dialog box opens in the browser, then the browser redirects to the download instructions page.

It could also work the other way around. The user clicks the button which takes them to the download page, then the file is a forced download. I'm not really bothered which way it works. Whichever is the most usable for the end user I guess.

If anyone could point me in the right direction I would really appreciate it.

Thanks in advance.

Chris.
London, UK.

bkeep

9:19 pm on Nov 9, 2009 (gmt 0)

10+ Year Member



I would do it the other way around Click download now and then redirect to install instructions page.

It should be pretty basic but can be ramped up a little.

I would have the actual file saved outside the webroot then when someone clicks the download now button they are taken to a user agreement and download instructions page. Have another link and when it is clicked read the file and dump it to the browser.

I don't know what the file type is but I use something like this to generate a csv on the fly and dump out to the brosers for download


$out = strlen($file_out);
if (isset($file_out)) {
header("Content-Length: $out");
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=$filename");
echo $file_out;
exit;
}

YMMV