Jump to content


This topic is now archived and is closed to further replies.


download count and download file in php

Recommended Posts

HI sir,

  i have a download file, now, when i click download button, it will open a middle php page, this page contain download counts and download file,then return download file.

  download.php -> middle php file (---------)->download.php

my code in middle page:

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=aaa.exe");

header("Location: download.php");

but, there's no effect in these download code, when i comment the last code, it can download it. how should i do it?

Share this post

Link to post
Share on other sites
reverse the logic, download.php,then middle.php. You can't redirect after a header ( download file );. So show download.php with your information, then include a meta refresh that points to middle.php!


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.