Skip to main content
Inspiring
March 10, 2008
Question

problem during downloading file...

  • March 10, 2008
  • 2 replies
  • 289 views
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
    This topic has been closed for replies.

    2 replies

    Astonished_protector15C3
    Participating Frequently
    March 18, 2008
    Hi
    In your file name there is white space after the New, this cause the issues
    Before uploading try to replace the white space to underscore (_)

    For Example

    Replace("New Site Plan.jpg"," ","_", "ALL")
    Inspiring
    March 10, 2008
    try getting rid of the spaces in the file name