Thursday, February 28, 2013

How to echo and play videos in Cakephp

I have an application were by users can upload images and should be able to echo and play videos. My upload function works fine but challenge that i am having now is to echo and play the video. Here is how i am uploading the file

    function uploadFile() {
    $file = $this->data['CpdVideo']['file'];
    if ($file['error'] === UPLOAD_ERR_OK) {
    $id = String::uuid();
    if (move_uploaded_file($file['tmp_name'], WWW_ROOT . 'files/videos/' . $file['name'])) {
    $this->request->data['CpdVideo']['filename'] = $file['name'];
    $this->request->data['CpdVideo']['filesize'] = $file['size'];
    $this->request->data['CpdVideo']['filemime'] = $file['type'];
    return true;
    }
    }
    return false;
    }

Here is how i am saving the video

    if ($this->uploadFile() && $this->CpdVideo->save($this->data))

This how i am trying to echo and play the video in my view.ctp

    <?php echo $this->Html->media('files/videos'. $cpdVideo['CpdVideo']['filename'], array('fullBase' => true));

If any one could help me out that would be awesome

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate