Question
problem during downloading file...
I have created a code where i specify a link to download the
file from the url, so i have a link like this:
http://www.mydomain.com/downloadfile.cfm?attach1=New Site Plan.jpg&id=27
so it just prompt me to download NEW.jpg rather than the whole New Site Plan.jpg
this is the way the file is appearing on the webpage as you specified:
as:
New%20Site%20Plan.jpg
here is what i am doing?
<cfif StructKeyExists(url,'id')>
<cfquery datasource="#request.dsn#" username="#request.username#" password="#request.password#" name="showfile">
select * from newsletter
where
id = <cfqueryparam cfsqltype="cf_sql_numeric" value="#url.id#">
</cfquery>
<cfoutput query="showfile">
<cfif IsDefined('url.attach1')>
<cfset a = ListLast(url.attach1,".")>
<cfif #a# EQ "zip">
<cfheader name="content-disposition" value="attachment;filename=#showfile.attachment1#">
<cfcontent type="application/x-zip-compressed"
file="#Application.SiteURL#Excel_CSV/attachments/#showfile.attachment1#" deletefile="no">
</cfif>
</cfif>
</cfif>
#Application.SiteURL# prompts to the right path, i have checked it
http://www.mydomain.com/downloadfile.cfm?attach1=New Site Plan.jpg&id=27
so it just prompt me to download NEW.jpg rather than the whole New Site Plan.jpg
this is the way the file is appearing on the webpage as you specified:
as:
New%20Site%20Plan.jpg
here is what i am doing?
<cfif StructKeyExists(url,'id')>
<cfquery datasource="#request.dsn#" username="#request.username#" password="#request.password#" name="showfile">
select * from newsletter
where
id = <cfqueryparam cfsqltype="cf_sql_numeric" value="#url.id#">
</cfquery>
<cfoutput query="showfile">
<cfif IsDefined('url.attach1')>
<cfset a = ListLast(url.attach1,".")>
<cfif #a# EQ "zip">
<cfheader name="content-disposition" value="attachment;filename=#showfile.attachment1#">
<cfcontent type="application/x-zip-compressed"
file="#Application.SiteURL#Excel_CSV/attachments/#showfile.attachment1#" deletefile="no">
</cfif>
</cfif>
</cfif>
#Application.SiteURL# prompts to the right path, i have checked it