CodeIgniter Forums
File download problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: File download problem (/thread-15425.html)



File download problem - El Forum - 02-04-2009

[eluser]Unknown[/eluser]
In my application, a person can by an ebook, when payment is completed a link to the file is send in email. By clicking on it an a function in controller is called which after validating a security code, renders view with the link to the file to download. By clicking on this link an other function is called which starts a download, I am using the php readfile method. the code for it is following,

header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"".basename($file)."\"");
readfile("$file");

After this we have code that updates the database. Now my problem is that I want to run this code after the file is completely downloaded.

Can anyone help me with this.


File download problem - El Forum - 02-04-2009

[eluser]Unknown[/eluser]
Hey,

Does anybody have any solution?


File download problem - El Forum - 02-04-2009

[eluser]LuckyFella73[/eluser]
hi,

I have no solution for you but found a link to
a post where this problem was discussed. They
didn't come toa final solution but maybe you
get some hints ...

http://bytes.com/groups/php/606924-check-if-file-downloaded