So I added a File Exists test (entire code below)
Then tried "escaping" the &
BTW, CFContent could not resolve a manually created symlink ---
interesting
Dick
<cfsetting enablecfoutputonly="yes" />
<cfoutput><br>#Application.Tracks[URL.TID]["Location"]#</cfoutput>
<!--- Decode the Location URL so we can use it as a file path --->
<cfset Location = Application.Tracks[URL.TID]["Location"] />
<cfset FilePath = URLDecode(ReReplace(Location, "file://localhost",
"")) />
<!---
<cfset FilePath = ReReplace(FilePath, "/Users/test/Music/iTunes/iTunes
Music", "iTunes Music alias") />
--->
<!--- Get the file extension --->
<cfset FileType = ReReplace(FilePath, ".*(\..*$)", "\1") />
<cfoutput><br>#FilePath#</cfoutput>
<cfoutput><br>#FileType#</cfoutput>
<!--- Abort if we can't find the file --->
<cfif NOT FileExists((FilePath)) >
<cfabort>
</cfif>
<!--- Serve content based on File Type --->
<cfif FileType EQ ".mov" >
<!--- This works for QT .mov files --->
<CFHEADER NAME="Content-Disposition" VALUE="attachment;
filename=movie.mov">
<cfcontent type = "video/quicktime"
file=#FilePath#
deleteFile = "No">
<cfelse>
<!--- this works for mp3 --->
<CFHEADER NAME="Content-Disposition"
VALUE="attachment; filename=song.mp3">
<cfcontent type = "audio/mp3"
file=#FilePath#
deleteFile = "No">
</cfif>
On Jun 29, 2004, at 6:22 PM, Jordan Michaels wrote:
> Interesting. Mind if I ask what went wrong? Was it passing an incorrect
> path or was the path not being interpreted correctly?
>
> Warm regards,
> Jordan
>
> Dick Applebaum wrote:
>
> > I actually tried "escaping" the ampersand with:
> >
> > 2 ampersands
> > \&
> >
> > neither works.
> >
> > Dick
> > On Jun 29, 2004, at 5:32 PM, Jordan Michaels wrote:
> >
> > > Would it be possible for you to do a Replace function on the path
> > > before
> > >��you pass it on to the tag? Just replace the one ampersand with
> two of
> > >��them and CF should interpret it correctly.
> > >
> > >��Just an idea...
> > >
> > >��--
> > >��Warm regards,
> > >��Jordan Michaels
> > >��Vivio Technologies
> > >��http://www.viviotech.net/
> > >[EMAIL PROTECTED]
> > >
> > >��Dick Applebaum wrote:
> > >
> > >��> On Jun 29, 2004, at 12:56 PM, Mark Drew wrote:
> > >��>
> > >��> > I am not sure if this would work (as I am not sure what
> precicely
> > > you
> > >��> >��are trying to achieve) but would CF mappings help in this
> case?
> > >��>
> > >��> I don't think mappings are the answer.
> > >��>
> > >��> Here's an example of the specific problem -- I want to serve
> an .mp3
> > >��> (could be a .mov) file from Apples iTunes directory
> sub-structure
> > > which
> > >��> might look as follows:
> > >��>
> > >��> --artist
> > >��> ----album
> > >��> -------track (song) name
> > >��>
> > >��> or
> > >��>
> > >��> --Willie Nelson & Ray Charles
> > >��> ----unKnown Album
> > >��> ------Seven Spanish Angels.mp3
> > >��>
> > >��> AFAIK, these fields can contain any valid character except
> colon (:)
> > >��>
> > >��> Now, I get the path to the tracks by parsing an XML file which
> > > yields a
> > >��> path:
> > >��>
> > >��> ..../iTunes Music/Willie Nelson & Ray Charles/unKnown
> Album/Seven
> > >��> Spanish Angels.mp3
> > >��>
> > >��> If I try to serve this with CFContent :
> > >��>
> > >��> <cfcontent type = "audio/mp3"
> > >��> file=#FilePath#
> > >��> deleteFile = "No">
> > >��>
> > >��> CFMX can't find the file -- it barfs on the & -- and I don't
> know
> > > how
> > >��> to escape it
> > >��>
> > >��> I suppose I could use a mapping and cflocation, but that
> exposes my
> > >��> file/directory structure.
> > >��>
> > >��> Dick
> > >��>
> > >��> "In times like these, it helps to recall that
> > >��> there have always been times like these."
> > >��> - Paul Harvey -
> > >��>
> > >
> >
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

