I have a page with a audio flash player that streams several mp3
files. This player uses an XML file that has the path of all those
files, which are in a audio folder in the webroot directory.

What I don't like is that it's pretty easy for a user to get to the
XML file (which is also in the webroot directory) and see the paths of
the mp3 files, and then download them instead of just using the flash
player.

I've seen that CakePHP has something called Media Views, where you can
set a folder outside the webroot and place your files there, so users
can't freely access them. The explanation in Cake's website (http://
book.cakephp.org/view/1094/Media-Views) is focused on files to
download, but I would like to know if I can use the Media Views to
stream my mp3 files with the audio player without making them
downloadable by the users. OR if there's any other alternative without
Media Views that would work as well :)

Thanks so much in advance!

CLARIFICATION

This is the code that I'm using that I would like to change:

- In my controller:

function index() {}

- In my view (index.ctp):

<embed type="application/x-shockwave-flash" flashvars="audioUrl=/
audios/01 Track 01.mp3" src="audio-player.swf"></embed>

=>How can I change that using Media Views so that my mp3 file is in a
folder app/audios instead of app/webroot/audios?

THIS IS WHAT I'VE TRIED:

- In my controller (streams_controller.php):

function index() {}

function getFile() {

    $this->view = 'Media';

    $params = array(
                    'id' => '01 Track 01.mp3',
                    'name' => '01 Track 01',
                    'download' => false,
                    'extension' => 'mp3',
                    'path' => APP . 'audios' . DS,
                    'cache' => true
                    );

    $this->set($params);
}

- In my view (index.ctp):

<embed type="application/x-shockwave-flash" flashvars="audioUrl=/
streams/getFile" src="audio-player.swf"></embed>

STILL NO LUCK! What am I doing wrong?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to