I did, let me dig around and see if I can find them.


I already posted the JSP code, here is the CF equivalent that writes the
file to disk and lets you view them. This doesn't take any more space either
as the cfcontent tag simply deletes the file after it has streamed to the
browser.

<cfparam name="SID" default="None">
<cfparam name="ID" default="0">
<cfparam name="Table" default="None">
<cfparam name="Extn" default="ext">
<cfparam name="UidField" default="ID">
<cfparam name="MediaField" default="Media">
<cfparam name="DirectorySet" default="c:\inetpub\wwwroot\Faxed\viewacts\">


<cfif #ID# IS "0">
            <p>
            General Error Occured
            </p>
            <cfabort>
<cfelse>
            <cftry>
                        <CFQUERY name="qryGetCV" datasource="#SID#">
                                    SELECT *
                                    FROM #Table#
                                    WHERE #uidfield# = #ID#
                        </CFQUERY>
                        
                        <cfcatch type="Database">
                                    A general database error has occured
trying to run the specified query!
                                    <p>
                                    SELECT *
                                    FROM #Table#
                                    WHERE #uidfield# = #ID#
                                    </p>
                                    <cfabort>
                        </cfcatch>
            </cftry>
            
            <!--- Create the Temp Files --->
            <cfdirectory directory="#DirectorySet#" name="qryFindIt">
            <cfset temp = ValueList(qryFindIt.Name)>


            <cfoutput query="qryGetCV">
                        <cfset FileVal = #Evaluate("qryGetCV." &
"#uidfield#")# & "." & #Evaluate("qryGetCV." & "#Extn#")#>
                        <cfset myCount = ListValueCount(temp, FileVal)>
                        <cfif #myCount# IS "1">
                                    <!--- Skip For Now --->
                        <cfelse>
                                    <cffile action=""> file="#DirectorySet##FileVal#" output="#toBinary(Evaluate("qryGetCV." &
"#mediafield#"))#" addnewline="No">
                        </cfif>
            </cfoutput>


            <cfset Ext =#Evaluate("qryGetCV." & "#Extn#")#>
            
            <!--- Display File in Browser --->
            <!--- Also deleted the file after it has been written to
conserve space --->
            <cfif Ext IS "PDF">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="application/pdf"
deletefile>
            <cfelseif Ext IS "TIFF" or Ext IS "TIF">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="image/tiff" deletefile >
            <cfelseif Ext IS "GIF">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="image/gif" deletefile >
            <cfelseif Ext IS "BMP">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="image/bmp" deletefile >
            <cfelseif ucase(Ext) IS "MAX">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="application/max" deletefile
>
            <cfelseif Ext IS "CSV">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="application/vnd.ms-excel"
deletefile >
            <cfelseif Ext IS "XLS">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="application/vnd.ms-excel"
deletefile >
            <cfelseif Ext IS "DOC">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="application/msword"
deletefile >
            <cfelseif Ext IS "MP3">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="audio/x-mpeg3" deletefile >
            <cfelseif Ext IS "TXT">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="text/html" deletefile >
            <cfelseif Ext IS "HTM">
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="text/html" deletefile >
            <cfelse>
                        <cfcontent
file="#DirectorySet##Evaluate("FileVal")#" type="text/html" deletefile >
            </cfif>
            
</cfif>

Stephen E. Schuster
PeopleSoft Administrator
2000 Ashland Drive
Ashland, KY 41101

Office Phone 606.920.7447
Cell Phone 606.831.4590

  _____  

From: Kevin Graeme [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 1:51 PM
To: CF-Talk
Subject: Re: Images - store in DB or filesystem?


Do you have a rough estimate of the performance difference of using this
streamed output via JSP compared to just doing a standard CF query?

-Kevin

----- Original Message -----
From: "Schuster, Steven" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, January 09, 2004 11:45 AM
Subject: RE: Images - store in DB or filesystem?

> For Inserts we just use the cf_blob type in MX 6.1 and do a direct insert
> into the blob.
>
> To retrieve we have this JSP page. This allows a direct stream read to the
> browser and does not write the file to the system and then attempt to read
> it. But we have code that does that as well if you need to look at it
also.
>
> This is a JSP page so you must be running MX for this to work (or a JSP
> alternative)
[snip
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to