Would you expect this to work? <cftransaction> <!--- retrieve the file details based fileID passed to me
---> <cfquery datasource="****"
name="filedetails"> select * from tblFiles where FileID = <cfqueryparam cfsqltype="cf_sql_varchar"
maxlength="35" value="#url.fileID#"> </cfquery> <!--- make sure we retrieve a valid record
---> <cfif filedetails.recordcount> <!--- increment download count ---> <cfset newdownloadcount = filedetails.downloadcount
+ 1> <!--- update download count -à <cfquery datasource="*****"
name="updatecount"> update tblFiles set downloadcount = <cfqueryparam
cfsqltype="cf_sql_integer" value="#newdownloadcount#"> where FileID = <cfqueryparam
cfsqltype="cf_sql_varchar" maxlength="35"
value="#url.fileID#"> </cfquery> <!--- fake header so browsers
don't try to download as current template name ---> <cfheader
name="content-disposition"
value="attachment;filename=#filedetails.filename#"> <!--- serve the file up with
CFCONTENT ---> <cfcontent file="c:\****\#filedetails.path#\#filedetails.filename#"
type="application/unknown"> </cfif> </cftransaction> It sends the file for download but doesn’t update the
download count in the db, if I comment out the cfheader/cfcontent block it
updates the Db so it’s not a code bug. Thanks, jb ********************************************************************** Copyright ERA Technology Ltd. 2004. (www.era.co.uk). All rights reserved. The information supplied in this Commercial Communication should be treated in confidence. No liability whatsoever is accepted for any loss or damage suffered as a result of accessing this message or any attachments. ********************************************************************** _____________________________________________________________________ This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com |
- Re: [ cf-dev ] serving files with cfcontent John Beynon
- Re: [ cf-dev ] serving files with cfcontent Stephen Moretti
- RE: [ cf-dev ] serving files with cfcontent John Beynon
- RE: [ cf-dev ] serving files with cfcontent Robin Griffiths
- Re: [ cf-dev ] serving files with cfcontent Stephen Moretti