We are pushing out files for a proprietary program and honestly do not remember why we do not push out the mime type for it. I know if the programs are installed on the workstation that the files do open up. I think on the Linux workstations they have to setup things in Firefox to recognize what program to use. Surprisingly we have not run into latency issues, the Oracle server is here in town but this application is used across the globe. Most of the files are pretty small with the exception of the printout files which can get enormous.
We used to have a Java class for pushing them out but I got tired of maintaining that and changed it to that CF code I posted up. We still do though use a Java class to collect the files from the proprietary program then use CF to read that, insert it into the database and delete the temp. file. The deletion of the temp. file sometimes throws an error. Have found CF just is not the best when you read and delete a file on the same page. It does not always release the file quick enough after the read to allow the deletion to happen. Going to just use Windows forfile tool to wipe that directory via a Windows schedule task. One day I'd like to be given the budget to just change collection of files to a web service. On Thu, Jul 22, 2010 at 1:48 PM, Chris Champion <[email protected]>wrote: > We did something similar. Stored the original filename to rapidly determine > mime-type. We had some peculiar latency issues so instead of directly > streaming we're writing to a temp directory. > > <cfsetting enablecfoutputonly="yes"/> > <cfsetting showdebugoutput="no"/> > <cfquery name="get_upload_data" datasource="mydsn"> > select file_binary, file_name > from table_about_files > where file_id = <cfqueryparam cfsqltype="cf_sql_numeric" > value="#variables.fileid#"> > </cfquery> > <cfif get_upload_data.recordcount> > <cffile action="write" output="#toBinary(get_upload_data.file_binary)#" > file="/tempdirectory/#get_upload_data.file_name#" mode="777"> > <!--- <cfheader name="Content-Disposition" value="attachment; > filename=#get_upload_data.file_name#"> ---> > <cfset fileext = listlast(get_upload_data.file_name,".")/> > <cfif fileext is "jpg" or fileext is "jpeg"> > <cfset filetype = "image/jpeg"/> > <cfelseif fileext is "gif"> > <cfset filetype = "image/gif"/> > <cfelseif fileext is "pjpeg"> > <cfset filetype = "image/pjpeg"/> > <cfelseif fileext is "pdf"> > <cfset filetype = "application/pdf"/> > <cfelse> > <cfset filetype = "application/x-unknown"/> > </cfif> > <cfcontent file="/tempdirectory/#get_upload_data.file_name#" > deletefile="yes" reset="no" type="#filetype#"> > <cfelse> > <cfheader statuscode="404" statustext="File not Found"> > <cfoutput><cfinclude template="/errorpages/404error.html"/></cfoutput> > </cfif> > > On Thu, Jul 22, 2010 at 1:12 PM, Aaron Rouse <[email protected]>wrote: > >> This is what we use to push out our project, data and image files. It is >> with Oracle 10g(I think, maybe 9i). Works with IE and Firefox(both on >> Windows and Linux). I suppose you could store the mime types so that you >> could do the actual mime type instead of type unknown. >> >> <cfparam name="URL.LOB_ID" default="0" type="numeric" /> >> >> <cfquery name="qryGetLob" datasource="#App.DataSource#"> >> SELECT BLOBDATA, SOURCE_PATH >> FROM LOB_TABLE >> WHERE LOB_ID = <cfqueryparam value="#URL.LOB_ID#" >> cfsqltype="cf_sql_numeric" /> >> </cfquery> >> <cfif qryGetLob.RecordCount IS NOT 0> >> <cfheader name='Content-Disposition' >> value='attachment;filename=#ListLast(qryGetLob.SOURCE_PATH, "\/")#'> >> >> <cfcontent type="application/unknown" variable="#qryGetLob.BLOBDATA#"> >> </cfif> >> >> On Thu, Jul 22, 2010 at 1:00 PM, Mark Davis <[email protected]> wrote: >> >>> I have some file attachments that I am reading and storing in a table (as >>> a BLOB datatype. Having trouble determining the process of reading the >>> BLOB back out and displaying the file to the user. The files can be just >>> about any type (doc, xls, some type of image, you name it). Anyone wanna >>> save me a headache? >>> >>> Thanks >>> >>> Mark >>> >>> -- >>> You received this message because you are subscribed to the "Houston >>> ColdFusion Users' Group" discussion list. >>> To unsubscribe, send email to [email protected] >>> For more options, visit http://groups.google.com/group/houcfug?hl=en >> >> >> >> >> -- >> Aaron Rouse >> http://www.happyhacker.com/ >> >> -- >> You received this message because you are subscribed to the "Houston >> ColdFusion Users' Group" discussion list. >> To unsubscribe, send email to [email protected] >> For more options, visit http://groups.google.com/group/houcfug?hl=en >> > > -- > You received this message because you are subscribed to the "Houston > ColdFusion Users' Group" discussion list. > To unsubscribe, send email to [email protected] > For more options, visit http://groups.google.com/group/houcfug?hl=en > -- Aaron Rouse http://www.happyhacker.com/ -- You received this message because you are subscribed to the "Houston ColdFusion Users' Group" discussion list. To unsubscribe, send email to [email protected] For more options, visit http://groups.google.com/group/houcfug?hl=en
