Tuesday, August 9, 2011

how to make download counter ?

I need to count download cakebaker guide me to use

$this->MyFile->updateAll(array('Script.download_counter'=>'Script.download_counter+1'),
array('Script.id'=>40));

I put it in


if ($id != null) {
$file = $this->Script->findByid($id);
$this->MyFile->updateAll(array('Script.download_counter'=>'Script.download_counter+1'),
array('Script.id'=>40));
header('Content-type: ' . $file['Attachment']['file_content_type']);
header('Content-length: ' .
$file['Attachment']['file_size']); // some people reported problems
with this line (see the comments), commenting out this line helped in
those cases
header('Content-Disposition: attachment; filename="' .
$file['Attachment']['file_name'] . '"');
echo $file['Attachment']['file_object'];

exit();


It's doesn't work

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate