CFheader and CFContent
Hello all-
I am having an issue with the tags cfheader and cfcontent.
This is the code I am using:
<cfheader name="Content-Disposition"
value="filename=Jurisdictionary.exe">
<cfcontent type="application/octet-stream"
file="c:\windown\Jurisdictionary.exe">
The issue is that my file is not being renamed correctly, I
keep getting a file with the extension of 'EFW'.
This did work at one time as I had been provided with thte
mime type of "octet-stream" but now that is not working, has anyone
got a solution or a site where I can get more info?
Thanks a bunch, you are all the very best there is and many
thanks to you in the past!!
Respectfully
MIke Dooly
mbdooly wrote:
> Hello all-
> I am having an issue with the tags cfheader and
cfcontent. This is the code I
> am using:
>
> <cfheader name="Content-Disposition"
value="filename=Jurisdictionary.exe">
Try value="attachment; filename=""Jurisdictionary.exe"""
Mack
Similar Messages
-
Load pdf with cfheader and cfcontent
I have the following code to load a PDF.
<cfquery datasource="lamtra1_data1" name="getpdf">
Select * from lamtracpdf WHERE id=#url.id#
</cfquery>
<cfoutput query="getpdf">
<cfheader name="Content-Type" value="pdf">
<cfheader name="Content-Disposition" value="inline;
filename=D:\hshome\lamtrac1\pdf\#filename#">
<cfcontent type="application/pdf"
file="D:\hshome\lamtrac1\pdf\#filename#" deletefile="No">
</cfoutput>
The problem I have is that the browser load the entired PDF
before open it. I would like to have the first page to load so the
user can start seeing the document while the rest of the pdf is
downloading... i do not want the pdf index in the search engine
because its confidential information so i have put the files before
the domain root. So I have to go with the code above to make it
load. The PDF is format correctly because if I load it from the
root it work correctly because it open right in acrobat reader but
in the way I did it the acrobat reader open in the browser thats
why i have to wait until the entired document have download before
starting viewing it... anybode have a solution for me please help
help????????mbdooly wrote:
> Hello all-
> I am having an issue with the tags cfheader and
cfcontent. This is the code I
> am using:
>
> <cfheader name="Content-Disposition"
value="filename=Jurisdictionary.exe">
Try value="attachment; filename=""Jurisdictionary.exe"""
Mack -
CFpdf and CFcontent shows filepath and filename in browser
Thanks to all for past help on my CF questions...
I've developed an upload application for (logged in to secure environment) users that uploads a pdf outside of the root, moves and renames the file and then cfpdf protects the file with a password. Part of the upload process inserts variables in a SQL database such as Catagory, Subcatagory, FileName, etc. The cffile move puts the file inside the root where I have a security framework. No problem with this.
I have a cfm page populated (dynamically) with links to the pdf files. These links contain url handlers that pass the filepath and filename. When a user clicks a link, he is carried to an index.cfm that has the security framework and within this page I have cfpdf link to the pdf file (and sets a password) and cfcontent loading the pdf file in the browser. All of this works just fine, as it should.
However... Because cfpdf sets the filepath/filename source and destination and passes this on to the cfcontent tag -- the filepath and filename are shown in the browser address bar as well as naming the download file the same as the http address (albeit with underscores) if the user saves the file. Anyone with any savvy can figure out the actual filepath and filename and go directly to the file in their browser. They'd still have to type in a password to view the file but I'd rather not have this filepath exposed like this.
Without having to create a copy of the original and rename the file, is there a way to change what is shown in the browser address and in the download filename? At some point there may be many pdf files uploaded and stored on this site. I'd rather not have 2 copies of each file on the server - the original and one renamed...
I've googled and googled and can't find an answer anywhere on this. Thanks to anyone pointing me in the right direction here.
- eFinally figured this out...
Since the file exists on the server, there's no need to use cfpdf and cfcontent to serve up the PDF.
When the PDF link is clicked, the user is directed to a page that has the security framework where there is a redirect to the PDF on the server. I have the PDF password protected. The PDF opens in the browser and, if saved, is saved with the file name only instead of the whole url+filename.
Learning to work with CF and PDFs through cfdocument and cfpdf lately has been somewhat frustratingly fun.(!) I guess it was overkill in trying to do the above when all I needed was a direct link to the file itself.
Hope this will help someone else...
- e -
Coldfusion 11 cfheader or cfcontent 'failed to load PDF document'
I have a website that worked fine with Coldfusion 10 and now I have updated to Coldfusion 11 and this code doesn't work:
<cfheader name="content-disposition" value="inline; filename=#vPublicFile#" />
<cfcontent type="application/pdf" file="#DownloadFolder##qryDownload.fileNameOnserver#" deleteFile="no" />
If I type in the URL directly to the PDF file it loads fine, but if I try to get it through this code then I get the message "failed to load PDF document". Even if I change the code to allow me to save the file, I get a saved file but it won't open in acrobat.
I know the code is working code, I tried it with Coldfusion 10 again just to make sure. Something about 11 is stopping it from working. Any ideas?I think that this is a iis web connector issue.
One of the worst cf update bugs I have ran into.
I have a lot of binary data served up with cfcontent, I never include "index.cfm," and almost always have query string params.
<cfheader name="Content-Length" value="#variables.FileSizeBytes#" />
<cfheader name="Content-Disposition" value="inline;filename=#variables.FileName#" /> (inline vs attachment makes no difference)
<cfcontent type="application/pdf" file="#variables.File#" />
/test/ - works
/test/index.cfm - works
/test/index.cfm?getPDF=1 - works
/test/?getPDF=1 - fails
Connection:close response header value there everytime it fails:
Connection:close
Content-Disposition:inline;filename=abcd.pdf
Content-Length:31739
Content-Type:application/pdf;charset=UTF-8
Date:Wed, 12 Nov 2014 20:59:55 GMT
Server:Microsoft-IIS/7.5
Response headers when it works:
Content-Disposition:inline;filename=abcd.pdf
Content-Length:31739
Content-Type:application/pdf;charset=UTF-8
Date:Wed, 12 Nov 2014 20:55:53 GMT
Server:Microsoft-IIS/7.5 -
I've been attempting to use cfcontent to supply an FLV file
to a flash application. I can't seem to get it to work. Does anyone
have an example of this?
I'm using FLVPlayback with contentPath to direct flash to the
cfcontent script. The flash works fine if I point directly to the
.FLV file. Do I need to use some other facility for playback when
using cfcontent?
The purpose of this whole thing is to limit access to the FLV
to people who are logged in. If you have a different suggestion on
how to do this, please let me know...
Thanks!Is there any option to get source materials from the host? Do you have a link to this site so we can take a look?
-
I'm using the Fusebox3 framework.
file: dsp_Invoice.cfm
<cfdocument format="pdf" orientation="portrait"
name="myPDF" overwrite="true">
<cfcontent type="application/pdf" variable="#myPDF#">
I get the binary results opened in Wordpad with the filename
default.cfm
Any ideas?
Tried using Foxit PDF reader on IE7 and Firefox2. Both
usually open PDF correctly from anywhere on the web.<cfheader name="Content-Disposition" value="inline;
filename=invoice.pdf">
<cfcontent type="application/pdf" variable="#myPDF#">
in place of just the cfcontent tag alone.
In any case, I would build the invoice document in
dsp_Invoice.cfm. Then I would open it in a separate page,
dsp_showInvoice.cfm, say, that contains just a cfheader and
cfcontent tag. -
Pdfs, cfcs and webservices
Hopefully someone can help me with this so I figure out what
I'm doing
wrong.
I have a cfc that is using cffile to grab pdfs, avis, mpegs,
etc. and
returning it to the user. For some reason can't get it
through to the user.
On the "invoking page" I'm using cfheader and cfcontent to
try and send the
file as an attachment to the user, but it won't work. If I
cfdump the
variable I get data, but I'm never prompted to open/save the
file. Using
regular cfm pages I have no problems. I have tried read,
readbinary,
toBinary with no luck.
Also I need this function to accessible as a webservice and
trying that
keeps returning an error about an invalid wsdl file and
couldn't create
stubs, but calling it from the same site results in the issue
above but no
wsdl error.
CFC Code
<cffunction name="getFile" access="remote"
displayname="Get File" hint="I
get a file based on the passed id.">
<cfargument name="docID" type="string" required="yes">
<cfset var doc = '' />
<cfset var filePath = expandPath('../Web_Support_Doc/')
& arguments.docID
/>
<cffile action="readbinary" file="#filePath#"
variable="doc" />
<cfreturn doc>
</cffunction>
Invocation Code
<cfsilent>
<cfset docFile =
createObject('component','_cfcs.file').getFile('1255KITG.pdf')
/>
</cfsilent>
<cfheader name="Content-Disposition" value="attachment;
filename=1255KITG.pdf">
<cfcontent type="application/unknown" file="#docFile#">
Web Service invocation code
<cfset docFile =
createObject('webservice','
http://innet/_cfcs/file.cfc?method=getFile&docID=#url.docID#')
/>
I'm using the same cfheader/cfcontent code from above to send
to user.
Any help would be greatly appreciated.
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/Nevermind had a Acrobat Reader install acting up for some
reason. Reinstall
seems to have fixed it.
Thanks Again for all the help Ian!
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
"Bash **AdobeCommunityExpert**"
<[email protected]> wrote in message
news:[email protected]...
> Apparently this is an IE issue as it works fine FF.
>
> --
> Bryan Ashcraft (remove brain to reply)
> Web Application Developer
> Wright Medical Technologies, Inc.
>
> Macromedia Certified Dreamweaver Developer
> Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
>
>
> "Bash **AdobeCommunityExpert**"
<[email protected]> wrote in message
> news:[email protected]...
>> Apparently these servers just don't like me. I get
the binary data dumped
>> on the page using your method.
>>
>> Basically I get a lot of this stuff:
>>
>> %PDF-1.2 %?? 12 0 obj << /Length 13 0 R
/Filter /FlateDecode >> stream
>> H?????????%=??6$Y`'??`gl??? ???\V????
>> TF??=O??2#fS??(?X?o??1#???&k????z?@v
>> ?'?8??5`qo!.?=??7???+????????Rf??
>> ????h?????�f?w??L!????????2{WwU??
\??fkB???]???!????? iw??]???Cg?
>> ?? sf???;?P???0????~Ig3h??
>>
>> --
>> Bryan Ashcraft (remove brain to reply)
>> Web Application Developer
>> Wright Medical Technologies, Inc.
>>
>> Macromedia Certified Dreamweaver Developer
>> Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
>>
>>
>> "Ian Skinner" <[email protected]>
wrote in message
>> news:[email protected]...
>>> Well if one tries hard enough one can do most
anything. The following
>>> code is serving up PDF files from a web service!
For some reason, I
>>> could not get this to work by sending the data
directly to the client
>>> with the cfcontent tag, but by writing the data
to a temp file and then
>>> sending that file to the client with cfcontent
worked.
>>>
>>> Hopefully you can build on this to solve your
problem.
>>>
>>> fileServing.cfm
>>> ---------------
>>> <cfset myFile="test.pdf">
>>>
>>> <cfheader name="Content-Type" value="pdf">
>>> <cfheader name="Content-Disposition"
value="attachment;
>>> filename=#Myfile#">
>>>
>>> <cfset testObj = createObject("webservice",
>>> "
http://playground/probono/fileServing.cfc?wsdl")>
>>>
>>> <cffile action="write"
file="g:\playground\probono\tempServe.pdf"
>>>
output="#BinaryDecode(testObj.serveFile(myFile),'Base64')#"
>>> addnewline="No" >
>>>
>>> <cfcontent type="application/pdf"
>>> file="g:\playground\probono\tempServe.pdf"
reset="no">
>>>
>>>
>>> fileServing.cfc
>>> ---------------
>>> <cfcomponent>
>>> <cffunction name="serveFile" access="remote"
returntype="string">
>>> <cfargument name="fileToServe" required="yes"
type="string">
>>>
>>> <cfset var fileObj = "">
>>> <cfset var returnVar = "">
>>> <cfset var file = "">
>>>
>>> <cffile action="readBinary"
>>>
file="g:\playground\probono\#arguments.fileToServe#"
variable="fileObj">
>>> <cfset returnVar =
binaryEncode(fileObj,"Base64")>
>>>
>>> <cfreturn returnVar>
>>> </cffunction>
>>> </cfcomponent>
>>
>>
>
> -
Streaming video to flash player with cfcontent
I am trying to stream (Progressive DL) h264 video in a quicktime container or (an flv for that matter) to a flash video player (Slidesho pro). Whilst I can get video as a downloaded file which plays correctly.
If I call the qt movie directly there is no problem, the player handles it.
<cfheader name="content-disposition" value="inline">
<cfheader name="content-type" value="video/quicktime">
<cfcontent type="video/quicktime" file="blah.mov">
What else do I need to put in this response to make it work ?
Does it need to be an octet stream ?
Finally I have NOT put in a content length as I understand that cfcontent usesand internal buffer so doesn't load the whole source file into memory first. (Thanks Ben Nadel's Blog)
REASON: Securing video.... Any answers out there please !!!!
GusYour headers might work only on Apple, because the Quicktime movie is native to Apple. In general, you would need an Apple plugin.
You should leave out the cfheader and cfcontent tag. Embed the movie using HTML's object and embed tags, much in the same way you would our own Adobe Flash movies.
<object id="moviePlayer" width="320" height="245"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="blah.mov">
<param name="autoplay" value="false">
<param name="controller" value="true">
<embed src="blah.mov" width="320" height="240"
autoplay="false" controller="true"
pluginspage="http://www.apple.com/quicktime/download/">
</embed>
</object> -
I'm having a problem generating an Excel file using CF and
looping over a bunch of queries to get a table of data to display
to the user. This is slow but works fine except for an instance
recently where the page seems to be loading but after a few minutes
it stops and says "the page cannot be displayed". The error leads
me to believe it is a server error and not a CF error but I'm not
sure. I don't have timeout checked in my CF Admin so that should
mean that I can request pages for as long as I need to right?
I'm using the cfheader and cfcontent to dynamically generate
an Excel spreadsheet from my HTML. I tried using the cfflush tag
and that seemed to help since it pushes content to the browser
during the page load but it doesn't work with the cfheader and
cfcontent tags.
So then I tried using the cfsavecontent tag and then save the
HTML to a file but again I couldn't use the cfflush tag inside the
cfsavecontent tag so now I'm stuck.
The page DOES load when I run in on my local machine with MX
6.1 Developer Edition and SQL Server Personal Edition. It DOES NOT
work when I run it on my production server that then calls my
separate database server. I'm wondering if there is a timeout (non
CF) set somewhere on the productions server or the database server
or if there is some sort of limit to the amount of data you can
transfer between servers?
I'm totally stumped now so any advice is greatly
appreciated!That didn't work for me and the page times out right about 5
minutes (300 seconds). I don't have timeout checked in the CF
Administrator so I don't think it is CF that is causing the
timeout. I checked IIS also and the timeout is set to 900 seconds.
Is there a possibility that SQL Server has some sort of
connection limit and I'm using too many cfquery tags? If anyone has
experienced a similar problem I would really appreciate the help,
thanks. -
Setting the zoom size of a PDF
Hi,
I'm using cfheader and cfcontent to open a PDF file for users
to view.
<cfheader name="Content-Disposition" value="inline;
filename=filename">
<cfcontent type="application/pdf" file="filename"
deletefile="No">
I'm just wondering is there any way to set the zoom percent
of the document when it opens in Acrobat?
Thanks,spatz04 wrote:
> I'm just wondering is there any way to set the zoom
percent of the document
> when it opens in Acrobat?
i know you can add stuff to the url & the reader will
interpret it:
http://bangkok/testCF/iText/registered.pdf#zoom=25?page=5
will cause the acrobat reader to open the registered.pdf at
page 5 & a zoom
factor of 25%. not exactly sure how you'd do it via
cfheader/cfcontent. maybe
add it to the filename parameter? -
Download file created from BLOB (as opposed to opening in browser)
Hello, everyone.
This project is really pushing me to become acquainted with a lot of functions I've never worked with, before.
The question, this time:
If I have a database table that houses files (and these can be PDF, TXT, DOC, XLS, or PPT) and would like to allow a user to download and save a particular file (as opposed to opening the file in the browser), how would I go about doing that?
If the file existed on the server, that'd be simple enough. But if it's being created on-the-fly via BLOB data??
V/r,
^_^Look at the cfheader and cfcontent tags. You can specify the MIME type of the file to have it open in the correct program on the user's end.
For example, on pdf files I usually do something like this:
<cfheader name="content-disposition" value="inline; filename=""whatever.pdf""" />
<cfcontent type="application/pdf" variable="#your_blob_variable#" />
Beware because some settings (like opening in a browser or not) are controlled by the user's preferences with that particular software. And different browsers behave differently (surprise). -
i use this code to embed a video file in a cf site:
<embed src="
http://mysite.com/pages/vid/#vid_file#"
width="408" height="375" autostart="1"
showstatusbar=1></embed>
is there something similar for a powerpoint presentation.
pref with ppt controls.
also seems that i have to call the root (domain) of site to
get video file to load ok... is this normal???
tnx in advance.If your userbase uses IE7 (haven't tested in FF), you can
load the PowerPoint presentation inline in the browser using
<cffile>, <cfheader> and <cfcontent>:
1) Read contents of PPT file using <cffile>
2) <CFHEADER NAME="Content-Disposition"
VALUE="inline;filename=myPowerpoint.ppt">
3) use CF content to set the right MIME-type (don't know off
the top of my head. check google) -
Custom 'Save As' file name for cfdocument
I have a page that generates a PDF (genPDF.cfm). When the
user attempts to save it, it saves as genPDF.pdf. Is there any way
that when they go to save it, I can dynamically name the document?
I am using Blue Dragon 7 here so any cool CF8 additional tags are
not accessible. I know, sucks, right? Thanks!no clue about BD, but in CF you would use a combination of
<cfheader>
and <cfcontent> tags to tell the web server how to
serve the file, what
mime type it is, what its name is and where to get the real
file from.
all details are in the cfml reference/livedocs. no clue if BD
has such
tags, but i would be surprised if it didn't...
<cfheader name="Content-Type" value="application/pdf">
<cfheader name="Content-Disposition" value="attachment;
filename=My_Super_Wicked_PDF.pdf">
<cfcontent type="application/pdf"
file="D:\MyFiles\Docs\PDF\This_PDF_is_actually_lame.pdf"
deletefile="No">
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/ -
Save query output as .csv, .xls
I am looking to save a bunch of query paramenters into a csv
file. i am currently playing around with cffile, cfcontent,
cfheader, but i dotn know what the best approach is. Ultimately i
want save dialog to pop up and allow the user to save it to the
desired location with desired name. what is the best way to do this
in cold fusion?
Thanks
DrewUse cfheader and cfcontent to get the pop up. Use table tags
to format your data. -
Open a file using windows dialogue box
I'd like a user to click on a link and they get the windows
dialogue box that asks if they want to save the document or open
it. How can I accomplish this?by using correct combinations of <cfheader> and
<cfcontent> tags with
appropriate attributes you may be able to force either
downloading/saving of files or opening them in the browser.
but many
browsers will enforce their own setting for a particular file
type.
short of creating 2 pages (say, view.cfm and save.cfm) and
putting 2
links to them next to the file name, you can't give users
much of a
choice, and even then it is not guaranteed to work for all
file
types/browsers.
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Maybe you are looking for
-
Blue screen error Windows 7 after June 2014 Windows updates
Hi, just wondering if someone could help determine the cause of a blue screen error from interpreting the following minidump file. My PC has been having blue screen problems after getting the automatic windows updates recently. Initially the only way
-
"Could not complete the custom command because the ICC profile is invalid"
I got the above message when I attempted to soft-proof an image in Photoshop CC on Windows 7 64-bit. I had downloaded the ICC profile from drycreekphoto.com, specifically: http://www.drycreekphoto.com/icc/Profiles/IccFiles/Arizona/Costco-AZ-Tucson-N
-
Payment processing is taking forever
Payment processing has been going for 20 minutes now? It says not to restart or refresh, but this is a little rediculous? Any advice? Thank you, WB
-
Amount posted to G/L Accounts
When I save the billing document, the amounts are posted to G/L accounts. Can some explain me the logic for posting signs - like Customer account is posted +ve Sales Revenue is -ve Discount is +ve etc
-
Recovering a .dvdproj from external drive
After burning a dvd and ending my dvd project, I am always asked if I want to save the project. I select yes and the project goes into the documents folder. Due to the amount of projects that I have I have selected to copy that .dvdproj to the extern