Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Zy Forever #1
Using CFHeader and CFContent to control file downloads
I am programming a CF application for an online university. They need to be
able to upload files to the server, and then authorize students individually as
to which files they can download. I've got this part written. Fortunately I
do have access to CFFile and CFDirectory tags, perfect for uploading. But the
problem comes in downloading. When I use CFHeader and CFContent to download
the file, I get unpredictable results. For instance, if the file is an MP3, it
streams in and plays on my IE, but allows me to save it on Netscape. If the
file is a PDF, it tries to load into my IE (and fails) but Netscape lets me
save it do disk. Obviously, this is not an acceptable solution. Please note
that in all cases, I do NOT want the file to stream or open inside a browser.
I want it to save on the user's computer. Am I using these two tags wrong? Or
are they so basic that they are unreliable for controlling downloads across
browsers? It seems a shame that uploads can be controlled so perfectly, but
downloading is sort of hit-or-miss. Any suggestions anyone?
Zy Forever Guest
-
problem downloading using CFCONTENT & CFHEADER
I am running into the same problem. Please reply if you find any fix to this problem. Thanks -
cfcontent ,cfheader download
i am sending an email to users in which there is a link for the coldfusion template , cfm page downloads the pdf file from the server , ... -
MIMEtype and Cfheader/Cfcontent
Hello all, We are using cfheader and cfcontent with a custom tag to hide the url of our downloadable files. We also have an exception page set to... -
CFHEADER, CFCONTENT, Acrobat 6.0 and InternetExplorer problem...
Originally posted by: cf_menace This works perfectly with Acrobat 6.0 and MSIE 6.0. The key to getting the PDF plug-in to save the PDF as the... -
Control File downloads?
I wish to control the number of files a web viewer can download say in a given time eg 1 minute,1 hour, Day etc to ease congestion. Whats the... -
cf_menace #2
Re: Using CFHeader and CFContent to control filedownloads
When you specify the correct mime-type, the user's browser takes over whatever
default action the user has specified for that type of file.
IIRC, if you set mime-type="application/unknown" for all file types, you
should always get the "Save As" dialog box.
cf_menace Guest
-
Zy Forever #3
Re: Using CFHeader and CFContent to control filedownloads
Thanks for the swift reply, cf_menace. Unfortunately, what it should do and
what it does are two different things. Here is my code: <cfheader
name='Content-Disposition' value='filename=#GetFile.FileName#'> <cfcontent
type='application/unknown' file='#RootDirectory#\#GetFile.FileName#'> This
produces the exact behavior I described above: sound files stream and play,
pdf files attempt to load into the browser. I do not get 'Save As' dialogue in
IE. I have tried changing it to mime-type='application/unknown', but cfcontent
in cf 4.5 won't accept mime-type as a parameter. So, not knowing what I'm
doing, I also tried type='mime-type=application/unknown' and
type='mime/application/unknown' ... neither of which worked. Is there another
way to code this? I've considered getting CFX_Zip and zipping each file before
it downloads. I'm pretty sure that a zipped file would have to evoke the 'Save
As' dialogue. What else would a browser do with it? I don't know if CFX_Zip
works with CF 4.5 though. However, if there is a cf solution without the
custom tag, I'd sure like to know about it.
Zy Forever Guest
-
cf_menace #4
Re: Using CFHeader and CFContent to control filedownloads
Try
<cfheader name="Content-Disposition" value="inline; filename=#GetFile.FileName#">
or
<cfheader name="Content-Disposition" value="attachment; filename=#GetFile.FileName#">
cf_menace Guest
-
Zy Forever #5
Re: Using CFHeader and CFContent to control filedownloads
Hi cf_ ... You are the greatest! The first option did not work. The second
one did: <cfheader name='Content-Disposition' value='attachment;
filename=#GetFile.FileName#'>I marked your post above as question answered.
Thank you so much! Zy
Zy Forever Guest



Reply With Quote

