CakePHP Media View

Anyone else out there using CakePHP 1.2 and trying to use the Media View component? I’m trying to hide the actual location of the MP3s on nebyoolae.com to make it seem more professional and give me more control over counting downloads (and maybe it’ll lower the number of random websites direct linking to songs).

I’ve tried two methods of implementation I found online (method 1, method 2), but neither seem to work, both resulting in a blank screen save for debug info. No file downloads, no request for the file is even made, nothing appears in logs, and no errors occur in the console. Debugging the parameters shows everything being correct and the file/folder where the media exists are accessible by my local machine, so I don’t know what’s up.

2 thoughts on “CakePHP Media View

  1. I know previously what we could have done in ASP.NET would have manually read the file into an IO Stream and binary write out the file to the HTTP stream with the HTTP header mime-type, length and file name set to the file actually being streamed.

    So your URL would be “blah.aspx?file=1” and it would stream like, “blah.mp3” out.

    Not entirely sure how you’d do that with CakePHP/PHP. But I think the idea is the same.

  2. It ended up being a simple path problem. Gah!

Leave a Reply

Your email address will not be published. Required fields are marked *