[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

Help retrieve file from below root directory

I am trying to use this flash button to stream mp3 sound bites.  I wan to store the files below the root directory so that they can not be downloaded.  I wrote the devloper at www.wimpyplayer.com and his response was this.  Can anyone help me figure out what can be done in CFMX to make this work.

Wimpy Button will not load files below the public root, simply because Flash is not a "server side" type of thing... it is a client side type of thing.

To load files below the public root, you'll have to develop a script that can retrieve the file, then feed the file to the payer.

You can do something like:
wimpy_button.swf?theFile=http;//path/to/scirpt.php%3Fthefile=1234_or_some_id

"%3F" is a URL encoded "?" -- since you can not have two ? symbols in the query to wimpy.

You script.php will then have to take the request and return the mp3 file.
0
jeffmace
Asked:
jeffmace
  • 6
  • 3
  • 2
2 Solutions
 
incapitalCommented:
If that's the case, you can use <cfheader> and <cfcontent> to return the file from a directory below the web root:

Assuming you pass in the file name as a URL variable (I called it 'fileName'), it would look something like this:
<cfset myDirectory = "c:\myMP3s\">
<cfheader name="Content-Disposition" value="inline; filename=#url.fileName#">
<cfcontent type="audio/mpeg" file="#myDirectory##url.fileName#">

Save this and pass the template into the URL as "theFile", and it should work.
0
 
jeffmaceAuthor Commented:
This is the code for using the Wimpy Flash Button

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" name="wimpy_button01"
 WIDTH="40" HEIGHT="40" id="wimpy_button_1">
      <PARAM NAME=movie VALUE="wimpy_button.swf?theFile=example.mp3">
      <PARAM NAME=quality VALUE=high>
      <PARAM NAME=wmode VALUE=transparent>
      <EMBED src="wimpy_button.swf?theFile=example.mp3" WIDTH="40" HEIGHT="40" quality=high NAME="wimpy_button01"
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>


I guess the part that I am not understanding is that by using the base code above, the mp3 file plays through the flash button, would this still work the same way?  Or will it open up Windows Media player or some outside player to play the file?  I will be diplaying a table that may have 20-30 sound effects on a page, so there would be 20-30 examples of this flash code.  Would you method still work?

Jeff
0
 
jeffmaceAuthor Commented:
Here is the test code I have so far.   It works fine with the regular HTML Link that I have.. It opens in Windows Media Player which ultimately isn't what I am looking for.  I want to see if it will stream through the flash button unless I am totally getting this wrong.

<table width="600" border="0" cellpadding="0" cellspacing="0">

<tr>
 <td bgcolor="#CCCCCC"><div align="center" class="style3">MP3 Title</div></td>
 <td bgcolor="#CCCCCC"><div align="center" class="style3">Author Name</div></td>
 <td bgcolor="#CCCCCC"><div align="center" class="style3">Category</div></td>
 <td bgcolor="#CCCCCC"><div align="center" class="style3">Flash Button Test</div></td>
 <td bgcolor="#CCCCCC"><div align="center" class="style3">Test HTML Link</div></td>
</tr>
<cfoutput query="x">
<tr>
 <td>#song#</td>
 <td>#band#</td>
 <td>#category#</td>
 <td align="center">
 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=6,0,47,0"
 width="40" height="40" id="wimpy_button_#ID#" name="wimpy_button_#ID#">
      <param name=movie value="wimpy_button.swf?theFile=file.cfm&filename=#mp3#">
      <param name=quality value=high>
      <param name=wmode value=transparent>
      <embed src="wimpy_button.swf?theFile=file.cfm&filename=#mp3#" quality=high width="40" height="40" name="wimpy_button_#ID#"
 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
 </td>
  <td align="center"><a href="file.cfm?filename=#mp3#">Stream Via HTML Link</a></td>
</tr>
</cfoutput>
</table>
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
incapitalCommented:
Without access to the component, I can't tell you for sure how it will respond, but it looks like the solution I proposed is consistent with what the developer suggested, and it will allow you to fetch an MP3 in a non-web-accessible directory.
0
 
jeffmaceAuthor Commented:
You can download the demo for Wimpy Button.  Its extremely small.

http://www.wimpyplayer.com/products/wimpy_button.html

0
 
incapitalCommented:
I got it to work immediately using two files... The first you can call 'servefile.cfm':

<cfset myDirectory = "c:\where i store my files">
<cfset myFile="myFileName.mp3">
<cfheader name="Content-Disposition" value="inline; filename=#myFile#">
<cfcontent type="audio/mpeg" file="#myDirectory##myFile#">

The second will contain the button:

 <!-- Start Wimyp Button Code -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/
flash/swflash.cab#version=6,0,47,0" width="35" height="35" name="wimpybutton138" id="wimpybutton138">
   <param name="movie" value="http://myDomain.com/wimpy_button.swf?serveFile.cfm" />
   <param name="loop" value="false" />
   <param name="menu" value="false" />
   <param name="quality" value="high" />
   <param name="bgcolor" value="#FFFFFF" />
   <embed src="http://myDomain.com/wimpy_button.swf?theFile=serveFile.cfm" width="35" height="35" bgcolor="#FFFFFF" loop="false" menu="false" quality="high" name="wimpybutton138" id="wimpybutton138" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>
<!-- End Wimpy Button Code -->

I'm using FireFox. I didn't test on IE.
0
 
jeffmaceAuthor Commented:
But how do you do it with dynamic file names.  If you have 5 songs and each one has a different button becuase its a different mp3.  So you need to have a dynamic tag in there somewhere for it to call the different names
0
 
jeffmaceAuthor Commented:
So anyhow, like you said I got it to work in FireFox but not IE.. Can anybody help with why this isn't working in IE?

Here is my servefile.com:
<cfset myDirectory = "E:\Inetpub\www\mp3\">
<cfset myFile="#URL.FileName#">
<cfheader name="Content-Disposition" value="inline; filename=#myFile#">
<cfcontent type="audio/mp3" file="#myDirectory##myFile#">


Here is my flash code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=6,0,47,0"
 width="40" height="40" id="wimpy_button_#ID#" name="wimpy_button_#ID#">
      <param name=movie value="wimpy_button.swf?servefile.cfm%3Ffilename=#mp3#">
      <param name=quality value=high>
      <param name=wmode value=transparent>
      <embed src="wimpy_button.swf?theFile=servefile.cfm%3Ffilename=#mp3#" quality=high width="40" height="40" name="wimpy_button_#ID#"
 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
0
 
pcaiooCommented:
Hope this can help

replace your servefile with follow
<cfset myDirectory = "E:\Inetpub\www\mp3\">
<cfset myFile="#URL.FileName#">
<cfheader name="Content-Disposition" value="filename=#myFile#">
<cfcontent type="#URL.MIME#" file="#myDirectory #myFile#">
<cfabort>
also submit your mimetype will be better.
0
 
jeffmaceAuthor Commented:
Can you explain why submitting my mimtype will be better when I am only using one type have that already placed in the code?  How does submitting it change anything?  Does IE read this differently than FireFox?  I am only using MP3 files.
0
 
pcaiooCommented:
then you can just hard code audio/mp3
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now