Download links for files on the server - help
I'm pretty much at the beginner level of ColdFusion. I'm using the latest version of Railo. I have a page where I list files in a directory on the server. No problem there.
When I link them, I'm not getting a prompt to download, it tries to go to a page which ends up not being found. I was told I need to use a combination of cfheader and cfcontent but I can't get it to work. The closest I've been is when I click a link, the page tries to load the file (mp3) in the browser so I just see a bunch of garbled text.
I've looked at adobe livedocs and saw something at bennadel. Just can't make much sense of it.
I know this is months old and you've probably given up on getting an answer, but CFCONTENT and CFHEADER is the way to go. Just make sure you've got the right MIME type specified.
I created a CFC that will return a mimetype based upon the file extension. I'll attach it for anyone who would like it.
<cfheader name="content-disposition" value="attachment;filename=[filename.ext goes here]">
<cfcontent type="[mimetype value]" variable="[binary data]">
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)