<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="http://livedocs.adobe.com/">
	<title>LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p33.htm</title>	
		<link>http://livedocs.adobe.com/</link>
		<description>Macromedia LiveDocs - online documentation with user feedback.</description>
		<copyright>Copyright 2009, Macromedia, Inc.</copyright>
		<dc:date>2009-11-24T20:30:48</dc:date>
		<dc:language>en-us</dc:language>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#54999" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#37700" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#37699" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#27535" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#26270" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#18387" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#18278" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#12722" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#12285" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#8326" />
			</rdf:Seq>
		</items>
	</channel>
	
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#54999">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#54999</link>
		<description>To answer  djdenv's concern about carriage returns, know that you can use the &lt;cfsetting&gt; tag to avoid this unreadable way of writing code.&lt;br /&gt;&lt;br /&gt;Also, without using &lt;cfsetting&gt;, all of the carriage returns after &lt;cftry&gt;, &lt;cffile&gt;, etc. will be sent to the browser as well.&lt;br /&gt;&lt;br /&gt;You can rewrite his example like so:&lt;br /&gt;&lt;br /&gt;&lt;cfsetting enablecfoutputonly=&quot;true&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;cftry&gt;&lt;br /&gt;&lt;cffile action=&quot;read&quot; file=&quot;#cgi.APPL_PHYSICAL_PATH#output.xml&quot; variable=&quot;myXML&quot;&gt;&lt;br /&gt;&lt;cfcatch type=&quot;any&quot;&gt;&lt;br /&gt;&lt;cfoutput&gt;#cfcatch.Message#&lt;/cfoutput&gt;&lt;br /&gt;&lt;/cfcatch&gt;&lt;br /&gt;&lt;/cftry&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfscript&gt;&lt;br /&gt;if (IsDefined(&quot;myXML&quot;))&lt;br /&gt;{&lt;br /&gt;myXMLDoc = XmlParse(myXML);&lt;br /&gt;&lt;br /&gt;selectedElements = XmlSearch(myxmldoc, &quot;/ALERTS/*/Image/&quot;);&lt;br /&gt;&lt;br /&gt;for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)&lt;br /&gt;{&lt;br /&gt;if (selectedElements[i].XmlAttributes[&quot;ID&quot;] EQ #url.PhotoID#)&lt;br /&gt;{&lt;br /&gt;selectedElement =selectedElements[i];&lt;br /&gt;data = ToBinary(SelectedElement.XmlAttributes[&quot;Data&quot;]);&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/cfscript&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfcontent type=&quot;image/jpeg&quot; reset=&quot;Yes&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfoutput&gt;#ToString(data)#&lt;/cfoutput&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfsetting enablecfoutputonly=&quot;false&quot;&gt;</description>
		<dc:creator>Chris Peters</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2006-10-24T06:34:49</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#37700">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#37700</link>
		<description>Since the messages don't allow editing or deleting, here is some more information to append to my post.&lt;br /&gt;&lt;br /&gt;The documentation should be edited to include a length variable, which limits the amount of information read in, so that you can read very large files with very little memory. The following is an example:&lt;br /&gt;http://us3.php.net/manual/en/function.fread.php</description>
		<dc:creator>Tacs</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-07-20T11:26:58</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#37699">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#37699</link>
		<description>jrunrandy still has not awnsered dnimmich's question which is my question as well:&lt;br /&gt;If this tag (or action) is not intended for use with large files, which tag or function actually is intended for it? Or don't Coldfusion developers need to read or process &quot;large&quot; files? &lt;br /&gt;&lt;br /&gt;If a webserver is limited by memory and diskswapping is being slowed down with this tag, what alternative tag do we use to bypass this problem. Example: one that sends information out in 8kb chunks so that only 8kb of memory is needed.&lt;br /&gt;&lt;br /&gt;Does coldfusion have a function like this?&lt;br /&gt;I need to read a large file (8gb log file) from a location on the hard drive that the webserver does not have acess to.</description>
		<dc:creator>Tacs</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-07-20T11:22:55</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#27535">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#27535</link>
		<description>It took forever for me to figure out how to do this, so I thought I would pass my findings along.  If you want to upload any type of file (binary) into your database with coldfusion, here's how I did it.  Yes, I'm aware that it is better to store a path to the file you want to access in the database rather than the file itself, but in some cases, storing the file directly in the database is needed.&lt;br /&gt;&lt;br /&gt;Here's my example:&lt;br /&gt;&lt;br /&gt;&lt;cffile &lt;br /&gt;action=&quot;readBinary&quot; &lt;br /&gt;file=&quot;TestDoc.doc&quot; &lt;br /&gt;variable=&quot;TargetFile&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfquery name=&quot;InsertFile&quot; datasource=&quot;myDatabase&quot;&gt;&lt;br /&gt;INSERT INTO FileStore&lt;br /&gt;(&lt;br /&gt;FileName,&lt;br /&gt;FileData&lt;br /&gt;)&lt;br /&gt;VALUES&lt;br /&gt;(&lt;br /&gt;'myFile',&lt;br /&gt;&lt;cfqueryparam value=&quot;#TargetFile#&quot; cfsqltype=&quot;cf_sql_blob&quot;&gt;&lt;br /&gt;)&lt;br /&gt;&lt;/cfquery&gt;&lt;br /&gt;&lt;br /&gt;It was the &lt;cfqueryparam&gt; that was trickey for me - you cant just use the #TargetFile# reference as ColdFusion seems to try to convert it to a string?  Additionally, I had to change the data type of the 'FileData' column in my database to an 'image' type, as 'binary' didn't seem to work.</description>
		<dc:creator>methik</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-02-07T12:19:30</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#26270">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#26270</link>
		<description>Hello... I successfully did what you're trying to do... &lt;br /&gt;I'm posting all my code below... essentially it reads in a base64 string from an XML file, then pushes it out as the image:&lt;br /&gt;&lt;br /&gt;&lt;cftry&gt;&lt;br /&gt;	&lt;cffile action=&quot;read&quot; file=&quot;#cgi.APPL_PHYSICAL_PATH#output.xml&quot; variable=&quot;myXML&quot;&gt;&lt;br /&gt;&lt;cfcatch type=&quot;any&quot;&gt;&lt;br /&gt;	&lt;cfoutput&gt;#cfcatch.Message#&lt;/cfoutput&gt;&lt;br /&gt;&lt;/cfcatch&gt;&lt;br /&gt;&lt;/cftry&gt;  &lt;br /&gt; &lt;br /&gt;  &lt;cfscript&gt;&lt;br /&gt;  	if (IsDefined(&quot;myXML&quot;))&lt;br /&gt;	{&lt;br /&gt;		myXMLDoc = XmlParse(myXML);&lt;br /&gt;		&lt;br /&gt;		selectedElements = XmlSearch(myxmldoc, &quot;/ALERTS/*/Image/&quot;);&lt;br /&gt;		&lt;br /&gt;		for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)&lt;br /&gt;		{&lt;br /&gt;			if (selectedElements[i].XmlAttributes[&quot;ID&quot;] EQ #url.PhotoID#)&lt;br /&gt;			{&lt;br /&gt;				selectedElement =selectedElements[i];&lt;br /&gt;				data = ToBinary(SelectedElement.XmlAttributes[&quot;Data&quot;]);&lt;br /&gt;				break;&lt;br /&gt;			}&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;&lt;/cfscript&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfcontent type=&quot;image/jpeg&quot; reset=&quot;Yes&quot;&gt;&lt;cfoutput&gt;#ToString(data)#&lt;/cfoutput&gt;&lt;br /&gt;&lt;br /&gt;Note, that the cfoutput and cfcontent MUST be on the same line. Otherwise, the carriage return is added to the data sent to the client and results in a broken image.</description>
		<dc:creator>djdenv</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-01-06T11:20:59</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#18387">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#18387</link>
		<description>LiveDocs is for documentation comments only and does not receive enough traffic to handle questions such as this. I suggest posting your issue to the online forums: http://webforums.macromedia.com/coldfusion/.</description>
		<dc:creator>halL</dc:creator>
		<dc:type>1 1</dc:type>
		<dc:date>2004-07-12T07:00:48</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#18278">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#18278</link>
		<description>Qouting from above:&lt;br /&gt;&lt;br /&gt;&lt;cffile action = &quot;readBinary&quot; file = &quot;C:\Inetpub\wwwroot\cfdocs\getting_started\photos\somewhere.jpg&quot; variable = &quot;aBinaryObj&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--- Output binary object to jpg format for viewing ---&gt;&lt;br /&gt;&lt;cffile action=&quot;write&quot; file = &quot;c:\files\updates\somewhereB.jpg&quot; output=&quot;#toBinary(aBinaryObj)#&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--- HTML to view image ---&gt;&lt;br /&gt;&lt;img src=&quot;C:\files\updates\somewhereB.jpg&quot;&gt;&lt;br /&gt;&lt;br /&gt;*** End of Qoute&lt;br /&gt;&lt;br /&gt;Does that work? Can the &lt;img&gt; tag reference an image outside of the document root. I guess if you setup coldfusion to reference to C:\files that would work.&lt;br /&gt;&lt;br /&gt;What about reversing the example.&lt;br /&gt;Copying a file from outside the document root into it. And then showing it with an &lt;img&gt; tag? Could that work.&lt;br /&gt;&lt;br /&gt;Also, is there a way to use &lt;cffile action=&quot;read&quot; file=&quot;/outside document root/someImageFile.jpg&quot; variable=&quot;request.image&quot; /&gt; and shove the data directly into an &lt;img&gt; tag, like &lt;img src=&quot;#toBase64( request.image )#&quot; /&gt;? Is there a way to do something like that?</description>
		<dc:creator></dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-07-09T23:33:03</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#12722">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#12722</link>
		<description>The &quot;large files&quot; note is relative to the amount of available memory and the potential number of simultaneous users.  If available memory is too small or there are too many simultaneous users, you might experience out of memory errors or increased response time due to disk swapping.</description>
		<dc:creator>jrunrandy</dc:creator>
		<dc:type>1 0</dc:type>
		<dc:date>2004-04-08T06:00:45</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#12285">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#12285</link>
		<description>If this tag (or action) is not intended for use with large files, which tag or function actually is intended for it? Or don't Coldfusion developers need to read or process &quot;large&quot; files?</description>
		<dc:creator>dnimmich</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-04-03T09:57:52</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#8326">
		<title>coldfusion/6.1/htmldocs/tags-p33.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p33.htm#8326</link>
		<description>SPELLING:  file /  Required / Pathname of a binary  FINE  to read. &lt;br /&gt;CORRECTION:  Pathname of a binary  FILE  to read. &lt;br /&gt;&lt;br /&gt;We are working to improve the examples in the ColdFusion reference pages. We propose to replace the current example on this page with the the following example. If you have any comments on this example, add them to this page.&lt;br /&gt;&lt;br /&gt;&lt;&lt; Old example was using cfserver.exe &gt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;cffile action = &quot;readBinary&quot; file = &quot;C:\Inetpub\wwwroot\cfdocs\getting_started\photos\somewhere.jpg&quot; variable = &quot;aBinaryObj&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--- Output binary object to jpg format for viewing ---&gt;&lt;br /&gt;&lt;cffile action=&quot;write&quot; file = &quot;c:\files\updates\somewhereB.jpg&quot; output=&quot;#toBinary(aBinaryObj)#&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--- HTML to view image ---&gt;&lt;br /&gt;&lt;img src=&quot;C:\files\updates\somewhereB.jpg&quot;&gt;</description>
		<dc:creator>lbryngel</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-02-18T08:28:35</dc:date>
	</item>
	</rdf:RDF>

