Coldfusion cfcontent file attribute




















Extensibility tags. You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. If your XML object is case sensitive, you cannot use dot notation to reference an element or attribute name.

Use the name in associative array bracket notation, or a reference that does not use the case-sensitive name such as xmlChildren 1 instead.

Now, ColdFusion attempts to get the content type from the file. ColdFusion MX 7: Added the variable attribute. Name of an on-disk or in-memory file whose contents provide the page output. The filename must start with a drive letter and a colon, or a forward or backward slash. When using ColdFusion in a distributed configuration, the file attribute must refer to a path on the system on which the web server runs. When you use this attribute, any other output on the current CFML page is ignored; only the contents of the file are sent to the client.

If you specify a file or variable attribute, this attribute has no effect; otherwise, it does the following:. The MIME content type of the page, optionally followed by a semicolon and the character encoding. However, if the file attribute is specified, ColdFusion attempts to get the content type from the file. The content type determines how the browser or client interprets the page contents.

The following are some of the content type values that you can use:. The cfcontent tag has one required attribute, type, which defines the MIME content type returned by the current page.

As you might expect, it is also written in HTML. Excel converts the table to a spreadsheet. Legal Notices Online Privacy Policy. Using cfcontent Search. This works like a charm. Now, you could have just written the text to the response stream and it would have done the same thing.

So why do it this way? Not exactly sure. I would think the best reason would be able to have a centralized file streaming template that always takes a binary object.

In that case, you would have to convert the text to binary before hand, but the idea is the same. Very true. I have run into that problem a few times. When that happens, at least with CFMX 6, you can at least stream a file, but it takes a few extra steps ex. I used thus technique before because putting json in response stream causes debugging info to come thru As well as the little used cfhtmlhead text.

Hi, I need to do something like that but with an excel file.



0コメント

  • 1000 / 1000