How about this?
<cfscript>
mimemap = structnew();
mimemap.xls = "application/x-msexcel";
mimemap.txt = "text/plain";
mimemap.doc = "application/msword";
mimemap.rtf = "text/richtext";
</cfscript>
<cfset attributes.extension = listLast(attributes.filename, ".")>
<cfcontent
file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
type="#mimemap[attributes.extension]#">
Patrick
> -----Original Message-----
> From: Greg Zentkovich [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 25, 2001 9:30 PM
> To: Fusebox
> Subject: RE: MIME-TYPES
>
>
> Thanks Steve,
>
> I'll try yours out, my fix worked, but was uuugggly!
>
> file 1
>
> <cfif right(name,4) is ".xls">
> <a
> href="index.cfm?fuseaction=viewfile&filename=#urlencodedformat(nam
> e)#&type=x
> &#request.urltoken#">#name#</a><br>
> <cfelseif right(name,4) is ".doc">
> <a
> href="index.cfm?fuseaction=viewfile&filename=#urlencodedformat(nam
> e)#&type=w
> &#request.urltoken#">#name#</a><br>
> <cfelseif right(name,4) is ".txt">
> <a
> href="index.cfm?fuseaction=viewfile&filename=#urlencodedformat(nam
> e)#&type=t
> &#request.urltoken#">#name#</a><br>
> <cfelseif right(name,4) is ".rtf">
> <a
> href="index.cfm?fuseaction=viewfile&filename=#urlencodedformat(nam
> e)#&type=r
> &#request.urltoken#">#name#</a><br>
> <cfelse>
> <a
> href="index.cfm?fuseaction=viewfile&filename=#urlencodedformat(nam
> e)#&type=x
> &#request.urltoken#">#name#</a><br>
> </cfif>
>
> file 2 -----
>
> <cfparam name="type" default="x">
> <cfswitch expression="#type#">
> <cfcase value="x">
> <cfcontent
> file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> type="application/x-msexcel">
> </cfcase>
> <cfcase value="w">
> <cfcontent
> file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> type="application/msword">
> </cfcase>
> <cfcase value="t">
> <cfcontent
> file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> type="text/plain">
> </cfcase>
> <cfcase value="r">
> <cfcontent
> file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> type="text/richtext">
> </cfcase>
> </cfswitch>
>
> one liners looks nicer :)
>
> TNX,
>
> Greg Z
>
>
>
>
>
> -----Original Message-----
> From: Steve Nelson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 25, 2001 3:38 PM
> To: Fusebox
> Subject: Re: MIME-TYPES
>
>
> ya, it has to be only one mime type, otherwise the browser doesn't know
> whether to send the file to excel or word.
>
> The best way i have done this is to store the mime type in the db and
> do:
>
> <cfcontent
>
> file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> type="#attributes.type#">
>
> Steve
>
> Greg Zentkovich wrote:
> >
> > Okay...I'm stumped and can't figure this out.
> >
> > This works...
> > <cfcontent
> > file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> > type="application/msword">
> >
> > and naturally this will work also...
> > <cfcontent
> > file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> > type="application/x-msexcel">
> >
> > but this however, does not work...
> > <cfcontent
> > file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> > type="application/msword,x-msexcel">
> >
> > nor this...
> > <cfcontent
> > file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> > type="application/msword,application/x-msexcel">
> >
> > nor this...
> > <cfcontent
> > file="c:\Inetpub\documents\#replace(attributes.filename,"..","","all")#"
> > type="application/*">
> >
> > Any fresh ideas?
> >
> > I need to be able to read msword and excel files via the browser but it
> > seems as if <cfcontent> will let you choose only one mime-type...
> >
> > TIA,
> >
> > Greg Z
> >
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists