Hey,

I modified the MediaView to be a Component, and added some stuff - you
can find the component here: http://bin.cakephp.org/view/599576961

1. Add to components array in the controller.
2. Parameters are the same, only you should use $this->Download-
>download($params); instead of $this->set($params); (And no need to
set the view to 'media'
3. the download-method returns true only successful download, false if
interrupted/cancelled
4. Additional variables are available after a file has been downloaded
(or not): $this->Download->speed (KB/s), $this->Download->time (How
long did it take to send the file), $this->Download->sent (If
interrupted, how much was sent to the user)

On Jan 3, 6:10 pm, DigitalDude <e.blumsten...@googlemail.com> wrote:
> Hey,
>
> in my app I have some type of file uploading, and also downloading.
> I'm using Cake's Media View, so I can send the file to the user after
> authenticating that he/she is allowed to get that file.
>
> So I was wondering, is there any chance to COUNT these downloads? All
> I have in my action is a view-like action which sets the params. I
> could then just save a counting value to my databse, but I think
> that's not really the way to go...
>
> (basic usage of the media view...)
>
>         $this->view = 'media';
>         $params = array(
>               'id' => $file['Upload']['hash'],
>               'name' => $file['Upload']['name'],
>               'download' => true,
>               'extension' => $file['Upload']['type'],
>               'path' => APP . '/uploads/'.$modelpath.'/'
>        );
>        $this->set($params);
>
> Is there any kind of callback or so after a user has successfully
> downloaded a file?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to