So, I have a download page where you click on the link, it opens / downloads / download / randomhash
randomhash is in db, I increment the download counter and then redirect to the actual file, e.g. / uploads / 2012 / file.png.
Everything works, except that the redirection does what I would like to do. I'm not sure why it is not working ...
header("Location: " . $row->uri); header("Content-Disposition: attachment; filename=$row->name");
The first time the file is uploaded, it has the corresponding content header (in firebug), but it does not ask for the file to be downloaded (what does it need, right?). Any ideas?
Answer headers:
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, public Connection: Keep-Alive Content-Disposition: attachment; filename=promotion_photo_2.jpg Content-Encoding: gzip Content-Length: 20 Content-Type: text/html; charset=utf-8 Date: Mon, 27 Feb 2012 01:01:22 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=100 Location: /uploads/2012/mediakitD3CF.jpg Pragma: no-cache Server: * Vary: Accept-Encoding X-Powered-By: * X-UA-Compatible: IE=Edge,chrome=1
source share